Hi,
I am in the process of migrating my work from wx (2.8, 3.0) classic versions to 4.x (phoenix) on my Ubuntu 14.04/18.04 machines. I see a strange behaviour during the use of StaticText with wx.Font. Attached is my code snippet.
In short, if a statictext name has space and if we use wx.Font on it, the name is written on multiple lines. But if the name doesn’t have space & used with font, the display on the Frame is OK. Also if the name with space is used without wx.Font, the display is ok on the Frame.
My Ubuntu 14.04 configuration
Python 2.7.6 on linux2, wxPython 4.0.6 gtk3 (phoenix) wxWidgets 3.0.5
Isolation:
Same code works ok on Windows
Same code works ok on Ubuntu 14.04 with wxgtk2.8
test.py (1.33 KB)


···
##########################
#!/usr/bin/env python
import wx
import wx.lib.scrolledpanel as scroll
import wx.lib.inspection
class IPClass(scroll.ScrolledPanel):
def __init__( self, parent):
scroll.ScrolledPanel.__init__( self, parent, -1, name = "Test" )
self.sizer = wx.BoxSizer( wx.VERTICAL )
#font = wx.Font(20.5, wx.FONTFAMILY_DECORATIVE, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, wx.FONTENCODING_DEFAULT)
name1 = "NAME WITH SPACES"
name2 = "NAME_WITHOUT_SPACES"
name3 = "NAME WITH SPACES WITHOUT FONT USAGE"
txt = wx.StaticText( self, -1, name1)
txt1 = wx.StaticText( self, -1, name2)
txt2 = wx.StaticText( self, -1, name3)
ft = txt.GetFont()
ft.PointSize += 2.5
ft = ft.Bold()
txt.SetFont(ft)
txt1.SetFont(ft)
self.sizer.Add( txt, 0, wx.ALIGN_LEFT|wx.ALL, 5 )
self.sizer.AddSpacer(10)
self.sizer.Add( txt1, 0, wx.ALIGN_LEFT|wx.ALL, 5 )
self.sizer.AddSpacer(10)
self.sizer.Add( txt2, 0, wx.ALIGN_LEFT|wx.ALL, 5 )
self.sizer.AddSpacer(10)
self.SetSizer( self.sizer )
self.SetAutoLayout(1)
self.SetupScrolling()
#-------------------------------------------------------------------------------------------------------------------------------
if name == “main”:
app = wx.App()
frame = wx.Frame(None, -1, "Test", size=(640, 480))
win = IPClass(frame)
frame.Show(True)
wx.lib.inspection.InspectionTool().Show()
app.MainLoop()
############################################################
Any ideas on where the problem could be?
