验证密码进入主框架

 

# -*- coding: utf-8 -*-
# Name:        module2
# Purpose:
# Author:      Rython
# Created:     2012-05-17

import wx
import MyPassword

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

 

你可能感兴趣的:(框架)