[wxPython-users] wx.StaticText size (12KB attachment)

Christopher Barker Chris.Barker at noaa.gov
Thu Dec 27 10:33:31 PST 2007


Algirdas Brazas wrote:
> I put several lines of 
> text using StaticText for each line. I calculate line positions having 
> in mind font size and adding some space. And there I get some problems - 
> StaticText size is actualy bigger than the text itself.

wx.StaticText is designed for simple labels and such -- not for more 
complex laing out of text. You can put them together with Sizers, but I 
think what you really want to do is to draw on your wx.Window or 
wx.Panel with wx.DC.DrawText() -- you can use wx.DC.GetTextExtents() to 
see how big each of your text elements are. Be forewarned that wx 
doesn't provide the tools to do real typesetting, but simple stuff works 
fine.

See the demo and Wiki for examples of how to use the wx.DC classes.

-Chris





-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov




More information about the wxpython-users mailing list