def __init__(self, parent, ID, title, pos=wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_FRAME_STYLE|wx.FULL_REPAINT_ON_RESIZE): wx.Frame.__init__(self, parent, ID, title, pos, size, style) self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) self.qqConnection = None ## 在Login方法里面创建 self.log = qqlib.initLogging() ## ... ##------------------------------------------- ## Install Menu menuBar = wx.MenuBar() menuAccount = wx.Menu() test=[] self.lb=wx.ListBox(self, 70, (300, 50), (90, 120), test, wx.LB_SINGLE) self.Bind(wx.EVT_LISTBOX_DCLICK, self.EvtListBoxDClick, self.lb) menuAccount.Append(101, u"登录", "") menuAccount.Append(102, u"退出程序", "") self.Bind(wx.EVT_MENU, self.Login, id = 101) self.Bind(wx.EVT_MENU, self.OnCloseWindow, id = 102) menuBar.Append(menuAccount, u"菜单") self.SetMenuBar(menuBar) self.statusbar = self.CreateStatusBar(1, wx.ST_SIZEGRIP) self.statusbar.SetStatusText(u"Python-QQ未登陆", 0)
def main(): log=qqlib.initLogging() nownum = 0 lastuid = '' getnum = 0 start = clock() if os.name == 'nt': qq_id=int(raw_input('请输入你的QQ号码:'.decode('utf-8').encode("cp936"))) pwd=getpass.getpass('请输入你的QQ密码:'.decode('utf-8').encode("cp936")) else: qq_id=int(raw_input('请输入你的QQ号码:')) pwd=raw_input('请输入你的QQ密码:') qq_user=qqlib.qq(qq_id,pwd,log) try: reactor.listenUDP(0, ConsoleProtocol(qq_user)) log.info ('Python-QQ开始运行') except Exception,ex: log.error(ex)
def main(): log = qqlib.initLogging() nownum = 0 lastuid = '' getnum = 0 start = clock() if os.name == 'nt': qq_id = int(raw_input('请输入你的QQ号码:'.decode('utf-8').encode("cp936"))) pwd = getpass.getpass('请输入你的QQ密码:'.decode('utf-8').encode("cp936")) else: qq_id = int(raw_input('请输入你的QQ号码:')) pwd = raw_input('请输入你的QQ密码:') qq_user = qqlib.qq(qq_id, pwd, log) try: reactor.listenUDP(0, ConsoleProtocol(qq_user)) log.info('Python-QQ开始运行') except Exception, ex: log.error(ex)
def main(): log=qqlib.initLogging() nownum = 0 lastuid = '' getnum = 0 start = clock() conn=socket(AF_INET, SOCK_DGRAM) conn.settimeout(60) threads=[] if os.name == 'nt': qq_id=int(raw_input('请输入你的QQ号码:'.decode('utf-8').encode("cp936"))) pwd=getpass.getpass('请输入你的QQ密码:'.decode('utf-8').encode("cp936")) else: qq_id=int(raw_input('请输入你的QQ号码:')) pwd=getpass.getpass('请输入你的QQ密码:') qq_user=qqlib.qq(qq_id,pwd,log,conn) protocol=ConsoleProtocol(qq_user) try: log.info ('Python-QQ开始运行') protocol.pre_login() except Exception,ex: log.error(ex)
threads.append(qqalive(protocol)) threads.append(qqinput(protocol)) for t in threads: t.start() for t in threads: t.join() log.error('程序运行结束或失败,如有异常情况请和作者联系。') log.info( "收到 %d 条", getnum) log.info("用时:%.2f 秒", (clock()-start)) log.info("每秒:%f条", (nownum / (clock()-start))) def abort(): sys.exit(1) if __name__ == "__main__": log=qqlib.initLogging() nownum = 0 lastuid = '' getnum = 0 start = clock() conn=socket(AF_INET, SOCK_DGRAM) conn.settimeout(60) threads=[] root = Tk() root.geometry("230x120") root.title("Python-QQ登陆") Label(root,text='Python语言实现的QQ客户端').place(x=8,y=3) Label(root,text='QQ号码:').place(x=15,y=30) Label(root,text='QQ密码:').place(x=15,y=55) qq_id = Entry(root,width = 16)