I have a question about GetTextExtent(). Somehow it gets me the height of the string much bigger than the string needs. Is there any way to correct it?
Or maybe the problem is elsewhere - when I draw wx.StaticText on screen there is some empty space on top and on bottom of the text, wich covers earlier drawn strings... You can see that in the attached image. Position of each StaticText field is lower by exactly the font size...
Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
GetTextExtent
- Bitmonster
- Site Admin
- Posts: 2239
- Joined: Mon Feb 06, 2006 10:28 pm
Re: GetTextExtent
Have you tried GetFullTextExtent()?
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
Re: GetTextExtent
My problem is more with wx.StaticText. I have done some tests and I can calculate line height manualy. The problem is in those blank spaces on top and bottom of the text. As You can see in my screenshot lower line covers part of upper line. In this screenshot lines should have 1 point between them, and if You'd measure the picture You'd see that it is so. But there is this blank space wich extends text and messes everything...
- Bitmonster
- Site Admin
- Posts: 2239
- Joined: Mon Feb 06, 2006 10:28 pm
Re: GetTextExtent
wx.StaticText has a size of its own. So it might add some borders.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
Re: GetTextExtent
Any other way to write text? Except bitmap drawing... Or this is the right way - to use memoryDC and draw the text as a bitmap?
- Bitmonster
- Site Admin
- Posts: 2239
- Joined: Mon Feb 06, 2006 10:28 pm
Re: GetTextExtent
It depends what you want to do. You can also write a full widget with a PaintDC handler and such things. Or you can try to resize the wx.StaticText.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
Re: GetTextExtent
I found wxPython mailing list and I think I'll ask the question about StaticText borders there. I'we searched documents and nowhere found any mention about any borders of some kind...
And what I want to do is to have my on screen menu line spacing smaller - You can see it looks ugly with it's current spacing...
And what I want to do is to have my on screen menu line spacing smaller - You can see it looks ugly with it's current spacing...
- Bitmonster
- Site Admin
- Posts: 2239
- Joined: Mon Feb 06, 2006 10:28 pm
Re: GetTextExtent
Keep in mind, that some languages have diacritical characters even for upper-case letters.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!