首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

印证密码进入主框架

2012-09-16 
验证密码进入主框架?# -*- coding: utf-8 -*-# Name:module2# Purpose:# Author:Rython# Created:2012-05-

验证密码进入主框架

?

# -*- coding: utf-8 -*-# Name:        module2# Purpose:# Author:      Rython# Created:     2012-05-17import wximport MyPasswordclass Frame(wx.Frame):    """Frame class that displays an image."""    def __init__(self, image, parent=None, id=-1,                 pos=wx.DefaultPosition, title=u'Hello, 人很冷'):        """Create a Frame instance and display image."""        temp = image.ConvertToBitmap()        size = temp.GetWidth(), temp.GetHeight()        wx.Frame.__init__(self, parent, id, title, pos, size)        wx.StaticBitmap(parent=self, bitmap=temp)        self.SetClientSize(size)class MyPasswordMyFrame( MyPassword.MyFrame ):    def __init__(self, parent):        MyPassword.MyFrame.__init__( self, parent )    def m_button1OnButtonClick( self, event ):        password = self.m_textCtrl2.Value        if password == '123456':            image = wx.Image('wxPython.jpg', wx.BITMAP_TYPE_JPEG)            self.frame = Frame(image)            self.frame.Show()##            self.SetTopWindow(self.frame)  #SetTopWindows方法属于App,而不属于Frame            self.Close()        else:            self.m_staticText3.SetLabel(u'密码输错了,请重新输入!')            self.m_textCtrl2.Clear()            self.m_textCtrl2.Refresh()##            self.m_textCtrl2.SetInsertionPoint(1)if __name__ == '__main__':    app = wx.PySimpleApp()    frame = MyPasswordMyFrame(None)    frame.Show()    app.MainLoop()
?

?

热点排行