import wx import gui app = wx.App() win = gui.login(None) win.Show(True) app.MainLoop()
# -*- coding: utf-8 -*- ########################################################################### ## Python code generated with wxFormBuilder (version Feb 26 2014) ## http://www.wxformbuilder.org/ ## ## PLEASE DO "NOT" EDIT THIS FILE! ########################################################################### import wx import wx.xrc ########################################################################### ## Class doctor1 ########################################################################### class doctor1 ( wx.Frame ): def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"医院电子病历信息系统", pos = wx.DefaultPosition, size = wx.Size( 1280,720 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) self.SetSizeHintsSz( wx.Size( 800,600 ), wx.Size( 1920,1080 ) ) bSizer1 = wx.BoxSizer( wx.VERTICAL ) bSizer1.SetMinSize( wx.Size( 800,600 ) ) self.m_button5 = wx.Button( self, wx.ID_ANY, u"MyButton", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer1.Add( self.m_button5, 0, 0, 5 ) self.m_button6 = wx.Button( self, wx.ID_ANY, u"MyButton", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer1.Add( self.m_button6, 0, 0, 5 ) self.SetSizer( bSizer1 ) self.Layout() self.Centre( wx.BOTH ) def __del__( self ): pass
"
test的代码有问题,因为test是在login类中,所以调用类属性时,直接使用self调用,详细修改如下:
# Virtual event handlers, overide them in your derived class
def test( self, event ):
uid=self.userid.GetValue()
upwd=self.userpwd.GetValue()
if uid=='123' and upwd=='321':
print 'True'
如果想点这个按钮之后弹出另外1个窗口,并且原来的窗口自动关闭怎么弄?
一样采用事件驱动,点击该按钮时运行另外一个GUI界面的代码,同时关闭当前界面
######非常感谢大神指点" ![image.png](https://ucc.alicdn.com/pic/developer-ecology/f0b4620ef153462cb4b54eee845049fe.png)版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。