【发布时间】:2013-05-07 04:10:47
【问题描述】:
大家好,我正在学习 python 语言,而对于 gui,我使用 wxpython。我的 GUI 中有 2 个旋转 ctrl、1 个文本 ctrl、1 个密码 ctrl。每当用户输入错误的密码时,它会弹出“密码错误”的消息。然后用户再次输入密码,但发生的情况是密码字段用“2 spin ctrl, and 1 text ctrl”重置,我想在用户输入错误密码时保留 spinctrl 和 textctrl 的值,消息框将显示 -向上。如何做到这一点?请给我建议。
class child(wx.Frame):
self.sc1 = wx.SpinCtrl(self,-1, pos=(-1, -1))
self.paswd = wxTextCtrl(self, -1, (-1, -1),(30,20))
def main(self, event):
lan1 = self.sc1.GetValue()
password = self.paswd.GetValue()
if lan1 > 16 :
wx.MessageBox("zzzzzzzzzzzz","warning")
if password = license(hard coded):
"""show message box
and install"""
else:
"""re enter password"""
Child().Show()
//when child window again pop up spin ctrl also set to 0, i want to keep spin ctrl value when user enter wrong password.
【问题讨论】:
-
@alecxe 我只做了我在描述中提到的那些,但后来开始搜索但没有得到解决方案,所以我要求提供建议或链接。