Open tvhdeeptho opened 5 years ago
This issue has been mentioned on Discuss wxPython. There might be relevant details there:
There is a wxWidgets issue which appears to reference the underlying problem: https://github.com/wxWidgets/wxWidgets/issues/19053
The wxWidgets' issue refers to it being related to bold font, but in the wxPython cases it seems to be related to changing the font size.
The last comment says "Unfortunately I won't have time to do anything about this before 3.2.0, sorry."
Operating system: Fedora 29 wxPython version & source: installed with pip3; wxPython 4.0.6 Python version & source: stock python3.7. but problem also occurs with python2
The wizard example code as found on https://wiki.wxwidgets.org/WxWizard fails to properly display all pages except the first one: large text is truncated. The code below is a slightly modified version to make it run under python3. The original example code has the same problem under python2.
Attached are screenshots of page1 (ok) and page2 (clipped). The code runs fine if I comment the setFont call. A similar issue was reported on stackoverflow https://stackoverflow.com/questions/52043176/wxpython-statictext-setfont-in-dialog-causing-layout-error but someone there reported not having the problem. So it may have something to do with the underlying environment This is what is installed on my computer: wxGTK3-3.0.4-4.fc29.x86_64 wxGTK3-gl-3.0.4-4.fc29.x86_64 gtk3-3.24.1-3.fc29.x86_64
import wx
import wx.wizard as wiz
import wx.adv as wiz import wx.lib.inspection
def makePageTitle(wizPg, title): sizer = wx.BoxSizer(wx.VERTICAL) wizPg.SetSizer(sizer) title = wx.StaticText(wizPg, -1, title) title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) sizer.Add(title, 0, wx.ALIGN_CENTRE|wx.ALL, 5) sizer.Add(wx.StaticLine(wizPg, -1), 0, wx.EXPAND|wx.ALL, 5) return sizer
class TitledPage(wiz.WizardPageSimple): def init(self, parent, title): wiz.WizardPageSimple.init(self, parent) self.sizer = makePageTitle(self, title)
app = wx.PySimpleApp() wizard = wiz.Wizard(None, -1, 'Simple Wizard') page1 = TitledPage(wizard, 'Page 1') page2 = TitledPage(wizard, 'Page 2') wiz.WizardPageSimple.Chain(page1, page2) wizard.FitToPage(page1) wx.lib.inspection.InspectionTool().Show() wizard.RunWizard(page1) wizard.Destroy() app.MainLoop()