wx.StaticText doesn't autoresize under Linux when changing font (GTK3)
Operating system: Linux (Fedora 30, GNOME 3) wxPython version & source: 4.0.4 (Fedora repos) Python version & source: Python 2.7, 3.7 (Fedora repos)
Description of the problem: wx.StaticText fails to automatically adjust its size when the font is changed like on other platforms (Windows/macOS).
import wx
app = wx.App()
frame = wx.Frame(None, title='Hello World')
panel = wx.Panel(frame)
st = wx.StaticText(panel, label="Hello World!")
font = st.GetFont()
font.PointSize += 10
font = font.Bold()
st.Font = font
frame.Show()
app.MainLoop()
Note that if a sizer is used, this issue wouldn't be a problem because the sizer uses the best size to calculate the layout.
import wx
app = wx.App()
frame = wx.Frame(None, title='Hello World')
panel = wx.Panel(frame)
st = wx.StaticText(panel, label="Hello World!")
font = st.GetFont()
font.PointSize += 20
font = font.Bold()
st.Font = font
sizer = wx.BoxSizer()
sizer.Add(st)
panel.SetSizer(sizer)
frame.Show()
app.MainLoop()
That said, this is an inconsistency that should probably be fixed. Please create a ticket for this at https://trac.wxwidgets.org/, if one doesn't already exist, and add a link to the ticket here so we can track it.
Thanks. After a bit of hunting, there indeed seems to be already a ticket for wxWidgets: https://trac.wxwidgets.org/ticket/16088
This issue has been mentioned on Discuss wxPython. There might be relevant details there:
https://discuss.wxpython.org/t/an-on-off-button-alternative-to-checkbox/36304/20