Hi All,
I am building a nice app which contains a (wx.lib.agw) CustomTreeCtrl on the left side. I have run the app on 2.8.11.0 up to now and everything was fine. However, I gave it a go and run it on 2.9.2.4 and now the CustomTreeCtrl items look like fat pigs, each of them occupying way too much vertical space (i.e., there is too much blank space between two adjacent siblings).
As the CustomTreeCtrl demo (apparently) does not exhibit this issue (or it does not exhibit it too much), I thought the reason my app is showing the problem is because I have mixed bold/normal fonts and also varying font sizes (between 8 and 11 points). Lo and behold, it appears that in 2.9.2.4 something has been changed in the way text extensions are measured using wx.DC.GetTextExtent (the wx.DC.GetMultiLineTextExtent suffers of the same problem) or I have missed some important migration note between 2.8 and 2.9.
On Windows 7, Python 2.5.4, If you run the attached sample using wxPython 2.8.11.0, you might see this output:
E:\MyProjects>dc_issue.py
What’s going on with dc.GetTextExtent()?
Python 2.5.4-final, wxPython 2.8.11.0 (msw-unicode)
Measuring string: Hello wxPython & wxWidgets
Font size : 9
Bold font : False
width, height : 188, 18
Font size : 9
Bold font : True
width, height : 220, 18
Font size : 11
Bold font : True
width, height : 266, 22
On Windows 7, Python 2.7.2, If you run the attached sample using wxPython 2.9.2.4, you might see this output::
E:\MyProjects>python dc_issue.py
What’s going on with dc.GetTextExtent()?
Python 2.7.2-final, wxPython 2.9.2.4 msw (classic)
Measuring string: Hello wxPython & wxWidgets
Font size : 10
Bold font : False
width, height : 224, 23
Font size : 10
Bold font : True
width, height : 240, 23
Font size : 12
Bold font : True
width, height : 284, 28
As you can see, in 2.9.2.4 both width and height are way off their (correct, as reported by wxPython 2.8.11.0) values, by a factor between 10% and 20%.
What am I missing?
Thank you in advance for your suggestions.
Andrea.
“Imagination Is The Only Weapon In The War Against Reality.”
http://xoomer.alice.it/infinity77/
import PyQt4.QtGui
Traceback (most recent call last):
File “”, line 1, in
ImportError: No module named PyQt4.QtGui
import pygtk
Traceback (most recent call last):
File “”, line 1, in
ImportError: No module named pygtk
dc_issue.py (1.7 KB)
···
import wx