0

I'm working on XP and using WX python As GUI library. Recently I look a lot of problems, for example If I Use a @MikeDriscoll 's example the code at the second print the python interpreter crashes, and I don't know why and how track this error (more important)...

import wx

########################################################################
class SampleDialog(wx.Dialog):
    """"""

    #----------------------------------------------------------------------
    def __init__(self, parent):
        """Constructor"""
        wx.Dialog.__init__(self, parent, title="Tutorial")
        print "Hello Here"
        btnOk = wx.Button(self, wx.ID_OK)
        print "Hello Here"
        btnCancel = wx.Button(self, wx.ID_CANCEL)
        btnSizer = wx.StdDialogButtonSizer()
        btnSizer.AddButton(btnOk)
        btnSizer.AddButton(btnCancel)
        btnSizer.Realize()
        self.SetSizer(btnSizer)

#----------------------------------------------------------------------
if __name__ == '__main__':
    app = wx.App(False)
    dlg = SampleDialog(None)
    dlg.ShowModal()
Community
  • 1
  • 1
gunzapper
  • 457
  • 7
  • 19
  • I'm not receiving a crash. You do seem to be missing a dlg.Destroy() and an app.MainLoop() at the end of your example though. Are you trying to run this from within IDLE? What OS, wxPython and Python version are you using? – Mike Driscoll Mar 18 '14 at 17:50
  • I'm using Window XP as OS, wx python 3.0.0.0, Python 2.7, I added also dlg.Destroy() and app.MainLoop() and neither, it doesn't work. I'm not using IDLE, but command prompt from DOS. The weird thing is that about one month ago all stuffs worked fine. – gunzapper Mar 19 '14 at 08:02
  • I don't know why.... but with wx 2.8.12.1 it works! – gunzapper Mar 19 '14 at 10:15
  • Sounds like a bug then. I would submit a bug report and / or ask on the wxPython Google group – Mike Driscoll Mar 19 '14 at 13:28
  • I'll try to submit the bug. Thanks Mike - P.S.: I read your blog ;) – gunzapper Mar 19 '14 at 22:29
  • This code snippet works fine on Windows 8, wxPython v3.0 and python v2.7 – ρss Apr 19 '14 at 15:52

0 Answers0