确定按钮在wxPython中崩溃

2024-06-25 23:55:25 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用XP和wxpython作为GUI库。最近我看到了很多问题,例如,如果我使用@MikeDriscoll 's example在第二次打印时,python解释器崩溃了,我不知道为什么以及如何跟踪这个错误(更重要的是)。。。你知道吗

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()

Tags: selfidhellohereinitbuttonparentdialog