Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8866281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:45:06+00:00 2026-06-14T16:45:06+00:00

Looking at the wxWidgets documentation , I see that one should be able to

  • 0

Looking at the wxWidgets documentation, I see that one should be able to set the text colour for a wxMenuItem object in Windows only. I am using Windows, so good.

When coding in wxPython and trying to accomplish this, not only do I not get the menu item’s text colour changed, but I notice that the menu item which follows this menu item in the same menu gets indented by 1 character. Very strange indeed. Should I remove the directive to set the text colour, the two menu items line up as expected.

So here is my code. I don’t see any mistakes in my code, but perhaps there is something because I am sure that indentation is a sign something is up.

menu = wx.Menu()
colour = (255,0,0) # like the text to be red
m_cluster = menu.Append(-1, "&Cluster\tAlt-C", "Cluster Options.")
m_cluster.SetTextColour(colour) # remembered to spell color with u
self.Bind(wx.EVT_MENU, self.OpenClusterDialog, m_cluster)
m_data = menu.Append(-1, "Data Source", "Set Data Source Information")
self.Bind(ex.EVT_MENU, self.OpenDataSourceDialog, m_data)
menuBar.Append(menu, "&Options") # menu bar previously defined

wxversion.py reports that I have 2.8-msv-unicode installed

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T16:45:07+00:00Added an answer on June 14, 2026 at 4:45 pm

    I played with your code and noticed that the color will only be applied if the menuitem is not yet appended to the menu. So instead of menu.Append(...), you need to to:

    m_cluster = wx.MenuItem(menu, -1, "&Cluster\tAlt-C", "Cluster Options.")
    m_cluster.SetTextColour(colour)
    menu.AppendItem(m_cluster)
    

    I’m on wx 2.9 so YMMV. I did not notice the indentation problem, but that can also be related to the version.

    Red menu item

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Looking for a control that allows to select one text value at a time
I'm looking to add an element to my wxWidgets GUI that behaves like a
Looking at some assembly code for x86_64 on my Mac, I see the following
Looking for a perl one-liner what will find all words with the next pattern:
I'm looking for a way to programatically generate keypress events in a C++ wxWidgets
Looking for a movie/TV API that offers previews (trailers), via widgets or links, as
Screenshot I'm looking to recreate this in Python; I can't find a library that
I wrote an application using wxWidgets that uses wxList . I am having some
I'm looking to be able to build GUI applications quickly and painlessly as possible.
I'm not looking to use something big like QT or wxWidgets' APIs. I just

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.