def LoginSuccess(self): self.count = int(self.LoginPanel.username.GetValue()) Chat.setMe(User("", self.count)) self.LoginPanel.Show(False) #在此初始化 self.menuBar = wx.MenuBar() self.friendList = wx.Menu() self.friendList.Append(100, "好友列表") self.menuBar.Append(self.friendList, "好友列表") self.msgList = wx.Menu() self.msgList.Append(200, "消息列表") self.menuBar.Append(self.msgList, "消息列表") self.addFriend = wx.Menu() self.addFriend.Append(300, "添加好友") self.menuBar.Append(self.addFriend, "添加好友") self.notifiList = wx.Menu() self.notifiList.Append(400, "通知列表") self.menuBar.Append(self.notifiList, "通知列表") self.friendList = wx.Menu() self.friendList.Append(500, "设置") self.menuBar.Append(self.friendList, "设置") self.SetMenuBar(self.menuBar) self.Bind(wx.EVT_MENU, self.ShowFriendList, id=100) self.Bind(wx.EVT_MENU, self.ShowMsgPanel, id=200) self.Bind(wx.EVT_MENU, self.ShowAddPanel, id=300) self.Bind(wx.EVT_MENU, self.ShowInformPanel, id=400) self.Bind(wx.EVT_MENU, self.ShowConfigPanel, id=500) self.ShowFriendList() self.timer = wx.Timer(self) # 创建定时器 self.Bind(wx.EVT_TIMER, self.Timer, self.timer) self.timer.Start(400)