somehow this does not work: self.list_box_1.SetForegroundColour(5,"red") SetForegroundColour is though listed in the api reference

Recommended Answers

All 10 Replies

However, this will work:
self.list_box_1.SetForegroundColour("red")

Well that is not what I want to do..
I want to colour a single item...

(I just see I made a typo it had to be SetItemForegroundColour)

Let's hope there is such a thing.

Or if not you must use tagging.

Excuse me but what do you mean with tagging?

Well listboxes are HTML okay, so you can put colours in. I know this works for text as i can see it working in the wxPython demo, i'm not sure that it would work for background.

If you look at listctrl's in the wxPython demo, they are similar yet have more advanced features and i personally have done individual colours for each item in a listctrl.

Anyway, hope that helps.

Well with the listctrl it indeed works, but I like the listbox more in this case,
and I want to change the text colour from some items...
is that included in the demo? O.o?

Yes, look for HTMLlistbox, it is a child of the listbox.

Okay, what is the equivalent of ListBox.Append(item) for HtmlListBox?
I can't find it in the api reference

Or if not you must use tagging.

Tagging is used with Tkinter only.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.