OK Button crashes in wxPython

做~自己de王妃 提交于 2019-12-25 18:23:18

问题


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

来源:https://stackoverflow.com/questions/22486372/ok-button-crashes-in-wxpython

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!