Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
377 views
in Technique[技术] by (71.8m points)

对话框如何正常关闭?

在对话框中这个类中,如何在自己的成员函数中把自己关掉(正常退出),隐藏也可以哦。开发环境是wxpython。简单点说,就是怎么正常退出。用destroy函数会报错。

代码如下:

        if registration[0:5] == '01:01':
            self.message_dia('恭喜你,注册成功!现在输入账号密码即可登陆')
            self.Destroy()

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

我用TextEntryDialog可以正常退出的。能否贴下你报错的代码和错误日志

dialog = wx.TextEntryDialog(None,"Input the subitem name","Subitem", style=wx.OK|wx.CANCEL)
if dialog.ShowModal() == wx.ID_OK:
    subitem = dialog.GetValue()
else:
    dialog.Destroy()

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...