[wxPython-users] Text on a bitmap or throbber

Robin Dunn robin at alldunn.com
Fri Nov 16 13:14:22 PST 2007


Craig Douglas wrote:
> Ok, not sure if there is a simple solution to this, but I have a throbber 
> which I want to put some user defined text onto.  My problem is that I need 
> the text to wrap and not go out of the size of the throbber, so I can't use 
> the built in label in throbber.
> 
> StaticText seems to take it's background colour from the background colour of 
> parent windows, which makes a mess of my throbber.  I'm needing just text over 
> my throbber with a trnsparent background which wraps and centers and the size 
> can be constrained.  Basically a StaticText with transparent backgrounds.
> 
> Searches haven't brought up much but i'm sure this is a relatively common 
> problem/requirement?

I would tackle this by deriving a new class from Throbber, and 
overriding it's Draw() method.  There you can call the base class Draw 
to get the current image drawn like normal, and then when it returns 
draw the text on the same DC however you want it to be drawn.

-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wxpython-users mailing list