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

Algirdas Brazas lists at digital.ktu.lt
Wed Jan 2 06:49:22 PST 2008


Thank You a lot. At the moment I'have figured out problem with text margins. 
What
I'we done is more a workaround, but it works :)
My problem was that the code:

font=wx.Font(18,wx.DEFAULT,wx.NORMAL,wx.BOLD)
memoryDC = wx.MemoryDC()
memoryDC.SetFont(font)
w,h=memoryDC.GetTextExtent("Test")

returned 29 for the height. In the example I'we used preconfigured size font, 
but in real app font is set by the user. Anyway, I found out, that if I multiply 
height by 0.6 I'll get average font height. And when drawing with wx.DC there is 
no more blank borders covering text, so it is working for the moment.

There is one more question that I google for 3 hourls already. I want to make 
background transparent. So I use self.SetTransparent(). But then I cannot make 
drawn text lines opaque. From the other side if I paint frame with transparent 
color I can see background color. How could I get rid of this background?
Or should I make frame size 0 and use ScreenDC?

Algirdas

----- Original Message ----- 
From: "Christopher Barker" <Chris.Barker at noaa.gov>
To: <wxPython-users at lists.wxwidgets.org>
Sent: Friday, December 28, 2007 7:33 PM
Subject: Re: [wxPython-users] wx.StaticText size (12KB attachment)


>
> Algirdas Brazas wrote:
>> Yep, I use GetExtents to get line size. And it is so, that this size is 
>> bigger than the text itself.
>> Excuse me for noobie question - when using wx.DC will I get the text as 
>> bitmap or will it still be selectable?
>
> Just the image -- a bitmap if you want, or just the screen itself. Any 
> selection or anything you want you'd have to write yourself. But wx.StaticText 
> doesn't provide selectable text either.
>
> Maybe you want the wx.RichTextCtrl, or another solution.
>
> If you give us the "big picture" of what you are trying to do, we can make 
> suggestions as to how you might do it.
>
> -Chris 




More information about the wxpython-users mailing list