Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 [WxPython] How to change font color of SetHint or SetDescriptiveText?

I am trying to make a search field with a hint inside with wxPython, but I can't seem to figure out how to change the colour of the hint. If I add a 'SetForegroundColour' the text I type in changes colour, but that doesn't really help. I also fiddled around with 'SetDefaultStyle' and 'wx.TextAttr' for some hours now, but can't figure out where to put them, if that is indeed what I should be doing. Also tried adding styles to the arguments of SearchCtrl like 'wx.TEXT_ATTR_TEXT_COLOUR', but nothing has worked.

query_field = wx.SearchCtrl(panel, pos=(10,10), size=(200,25))
I have made the background black so I can see that there actually is text inside the field, because when I change the background to white, it is completely invisible.

So if anyone could point me in the right direction, it would be really great.

Thank you.
@anistorian as a pointer going forward should you post another question -- denoting clearly what you are using within the subject or via a tag is very helpful to those of us that might be able to lend you a hand as there are several different flavors or GUIs being serviced within this forum

Not knowing wxPython, excuse me if this unnecessary, I would still think that clearly prefixing your question with what python version you are using as well as what wxPython version you are using might also prove of great assistance to someone trying to help you.

Good luck in getting your wxPython answer
Hi Denni, I will surely keep that in mind! Thought it would be enough to write that I used wxPython within the post. But for anyone who might be able to help, I run macOS 10.14.5, python 3.7 and wxPython 4.0.6.

Thank you for the advice.
I could try to translate this, but I am relatively new myself. Try using the RichToolTip, and you may need to set the foreground color in the wx.font. See RichToolTip description for wxPython
Hi! Thank you for your reply, but I think I found the problem. Even though it might not be a solution. Since the searchctrl utilizes a native widget, I don't think it is possible to change the font colour, since it is defined by my OS theme.
I expect that to be the case, i put a post up on google groups 'wxpython-users' on your behalf but have had no reply's yet.

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  change background color of button ieee488 3 2,631 Jul-30-2019, 09:49 PM
Last Post: ieee488
  [Tkinter] So what do I need to do change the color this label? jpezz 10 1,171 Apr-03-2019, 09:49 PM
Last Post: jpezz
  [Tkinter] Tkinter Font Color notsolowki 11 25,990 Mar-28-2018, 03:53 AM
Last Post: notsolowki
  Change color of a row of a QTableView? panoss 7 16,888 Sep-23-2017, 03:02 PM
Last Post: Mafireyi
  PyGTK3, I can't Change Button and Table Backgorund Color using modify_bg method. harun2525 3 4,519 Apr-24-2017, 04:05 PM
Last Post: changos
  [Tkinter] Change background color sparkz_alot 3 19,316 Dec-10-2016, 02:15 PM
Last Post: sparkz_alot

Forum Jump:

Users browsing this thread: 1 Guest(s)