1) Under Linux-Gtk, (not under windows) a static text control is 'transparent', only render the text. So you can set text colour, but not the background.
2) A panel is a container (dont have a caption), you can add a static text to a panel and then set the panel background and the static text foreground colour:
...
self.panel1.SetBackgroundColour(wxColour(216, 191, 216))
...
self.staticText1.SetForegroundColour(wxColour(0, 0, 255))
...
I have a feeling I've asked this one before, however simple one, so here
goes.
1) There seems to be no way to set the background colour of a static text
control.
Not on wxGTK because it's not a true window, just a widget that is drawn on
its parent. You could create your own static text control quite easily.
That way it would b a true window and so would be able to have the colours
set, respond to mouse events, etc. You could start with the wxGenButton
class in wxPython/lib/buttons.py and remove everything about being a button
(mouse events, bevel drawing, etc.)
2) Can a panel itself have a caption, with the foreground colour of the
caption being able to be anycolor?
Not unless you draw it yourself, or use the class you created for the above
and just position it at the top of the panel.
···
--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters? http://wxPython.org Relax with wxPython!
I have a feeling I've asked this one before, however simple one,
so here goes.
1) There seems to be no way to set the background colour of a
static text control.
General rule: if a class seems to lack some method or member, look at
its superclass(es). In this case, SetBackgroundColour() seems to be
what you're after, and that's method in the wxWindow base class.
2) Can a panel itself have a caption, with the foreground colour
of the caption being able to be anycolor?
A panel is just an empty window on which to put other windows. So, if
you want it to have a caption you'll have to put something like
wxStaticText on. A wxHtmlWindow is a good choice for a more flexible
rendering of text, as you can freely mix all kind of colouring, fonts
and text decorations that way, and the text will also wrap if the
window is too narrow.