我正在使用XP并使用WX python作为GUI库。最近我看了很多问题,例如如果我在第二次打印时使用@MikeDriscoll 's example代码,python解释器崩溃了,我不知道为什么以及如何跟踪这个错误(更重要)... < / p>
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()