def OnSetLanguage( self, evt ): langId = evt.GetId() if langId == 401: self.SetLabel( u"第三次上机练习" ) self.menuBar = myMenu.initChineseMenu() self.SetMenuBar( self.menuBar ) self.menuBar.Check( 301+self.cursorSelector, True ) self.bLanguage = True else: self.SetLabel( "lab3" ) self.menuBar = myMenu.initEnglishMenu() self.SetMenuBar( self.menuBar ) self.menuBar.Check( 301+self.cursorSelector, True ) self.bLanguage = False self.Refresh()
def __init__(self): wx.Frame.__init__( self, None, -1, u"第三次上机练习", size = (800,650)) icon = wx.Icon( name = "icon1.ico", type = wx.BITMAP_TYPE_ICO) self.SetIcon( icon ); self.menuBar = myMenu.initChineseMenu() self.SetMenuBar( self.menuBar ) self.CreateStatusBar() self.Bind( wx.EVT_MENU, self.OnClose, id=wx.ID_EXIT ) self.Bind( wx.EVT_MENU, self.OnModeDialog, id=201 ) self.Bind( wx.EVT_MENU, self.OnModelessDialog, id=202) self.Bind( wx.EVT_MENU, self.OnFileDialog, id=203) self.Bind( wx.EVT_MENU_RANGE, self.OnChangeCursor, id=301, id2=303 ) self.Bind( wx.EVT_MENU_RANGE, self.OnSetLanguage, id=401, id2=402 ) self.Bind( wx.EVT_MENU, self.OnHelp, id=501 ) self.Bind( wx.EVT_PAINT, self.OnPaint ) self.bCheckBox = [ False, False, False ] #设置模式对话框位图unchecked self.bRadioButton = [ True, False, False ] #设置无模式对话框位图选择情况 self.bLanguage = True # True means Zh, False means En self.cursorSelector = 0 # 0 -> ARROW, 1 -> CROSS, 2 -> USER_DEFINED #create three bitmaps to show image = [ wx.Image( name="bmp1.bmp", type=wx.BITMAP_TYPE_JPEG ), wx.Image( name="bmp2.bmp", type=wx.BITMAP_TYPE_JPEG ), wx.Image( name="bmp3.bmp", type=wx.BITMAP_TYPE_JPEG )] self.bmp = [ image[0].ConvertToBitmap(), image[1].ConvertToBitmap(), image[2].ConvertToBitmap() ] self.cursorZhStr = [ wx.StaticText(self, -1, u"当前使用的光标是:ARROW", pos=(50,30)), wx.StaticText(self, -1, u"当前使用的光标是:CROSS", pos=(50,30)), wx.StaticText(self, -1, u"当前使用的光标是:我画的光标", pos=(50,30)) ] self.cursorEnStr = [ wx.StaticText(self, -1, "The current cursor is: ARROW", pos=(50,30)), wx.StaticText(self, -1, "The current cursor is: CROSS", pos=(50,30)), wx.StaticText(self, -1, "The current cursor is: USER_DEFINED", pos=(50,30)) ] for eachStr in self.cursorZhStr: eachStr.Hide() for eachStr in self.cursorEnStr: eachStr.Hide()