I’ve run into a segmentation fault with wxPython 4.1.1 when I call Center
or Centre
on wx.MessageDialog
. No segmentation fault with wxPython 4.1.0 (but look like this isn’t centering the window either?).
Maybe I’m not supposed to call Center
before showing, but I’m not sure how else to center a modal?
import wx
DO_CENTER = True
class MainFrame(wx.Frame):
def __init__(self, *args):
wx.Frame.__init__(self, *args)
msg = "wxPython %s\nCenter Called: %s" % (wx.version(), DO_CENTER)
self.dlg = wx.MessageDialog(self, msg, "Diaglog Center Test")
if DO_CENTER:
self.dlg.Center()
self.dlg.ShowModal()
self.dlg.Destroy()
class MainApp(wx.App):
def OnInit(self):
self.frame = MainFrame(None, wx.ID_ANY, "")
self.frame.Show()
return True
def start():
app = MainApp()
app.MainLoop()
if __name__ == "__main__":
start()