def OnGWeibo(self, i): '获取数据写入数据库' sinaapi = sina_sdk.myapi() while not self.wbtdflag: try: sinaapi.user_status(int(self.id), page=i) break except: pass print "x weibo ",i,"page",(i-1)*40,"end" self.wbtdflags[i-1] = True if(i == 1): flags = False while not flags: #线程全部结束 truecnt = 0 for j in range(5): if self.wbtdflags[j]:truecnt+=1 #print "truecnt:", truecnt, self.wbtdflags if truecnt>=5: flags=True #线程全部结束 time.sleep(0.1) try: print "*** count..." self.OnCount() #'''统计信息''' except Exception, e: print e self.wbtdflag = True
def OnGWeibo(self, i): '获取数据写入数据库' sinaapi = sina_sdk.myapi() while not self.wbtdflag: try: sinaapi.user_status(int(self.id), page=i) break except: pass print "x weibo ", i, "page", (i - 1) * 40, "end" self.wbtdflags[i - 1] = True if (i == 1): flags = False while not flags: #线程全部结束 truecnt = 0 for j in range(5): if self.wbtdflags[j]: truecnt += 1 #print "truecnt:", truecnt, self.wbtdflags if truecnt >= 5: flags = True #线程全部结束 time.sleep(0.1) try: print "*** count..." self.OnCount() #'''统计信息''' except Exception, e: print e self.wbtdflag = True
def OnGFriend(self): '获取朋友信息写入数据库' sinaapi = sina_sdk.myapi() #while not self.wbtdflag: try: sinaapi.imputfriends(int(self.id)) except: pass self.fdtdflag = True
def run(self, index): if index == 0: self.api = sina_sdk.myapi() elif index == 2: self.api_twitter = twitter.Api() elif index == 3: self.api_facebook = facebook.FacebookApi() elif index == 1: self.renren = iseeu_renren_api.iseeu_api_xn() self.curpage = 0 nAllPageCount = self.nPageCnt self.nPreThPageCount = int(nAllPageCount / self.nPreApiNun) #每个线程处理多少页 if self.index == 1: self.nPreThPageCount = 50 / self.nPreApiNun if self.index == 2: self.nPreThPageCount = 10 / self.nPreApiNun while self.curpage <= self.nPreThPageCount: now = time.time() if self.index == 0: #sina_api if self.api.imputdata( self.key, self.curpage + (self.nWhichThread - 1) * self.nPreThPageCount) == "iseeu_nodata_again": self.getPageCnt[0] += (self.nPreThPageCount - self.curpage) + 1 break elif self.index == 1: #renren #if self.nWhichThread == 2:time.sleep(1) self.renren.users_search( self.key, self.curpage + (self.nWhichThread - 1) * self.nPreThPageCount) elif self.index == 2: #twitter_api try: self.api_twitter.Search_users( q=self.key, page=self.curpage + (self.nWhichThread - 1) * self.nPreThPageCount) except Exception, e: print "-------------------twitter error", e pass if (self.bIsChiThreadDead == True): print "kill", "api", self.index, "thread", self.nWhichThread thread.exit() searchThread.lock.acquire() self.getPageCnt[0] += 1 searchThread.lock.release() last = time.time() #print "Api",self.index,"Thread",self.nWhichThread,"page",self.curpage,"use time",last-now,'all page:',self.getPageCnt[0] self.curpage += 1
def run(self, index): if index==0: self.api=sina_sdk.myapi() elif index==2: self.api_twitter=twitter.Api() elif index==3: self.api_facebook = facebook.FacebookApi() elif index==1: self.renren = iseeu_renren_api.iseeu_api_xn() self.curpage= 0 nAllPageCount = self.nPageCnt self.nPreThPageCount=int(nAllPageCount / self.nPreApiNun) #每个线程处理多少页 if self.index == 1: self.nPreThPageCount = 50 / self.nPreApiNun if self.index == 2: self.nPreThPageCount = 10 / self.nPreApiNun while self.curpage <= self.nPreThPageCount: now=time.time() if self.index == 0: #sina_api if self.api.imputdata(self.key,self.curpage + (self.nWhichThread - 1)*self.nPreThPageCount)=="iseeu_nodata_again": self.getPageCnt[0] += (self.nPreThPageCount - self.curpage)+1 break elif self.index == 1: #renren #if self.nWhichThread == 2:time.sleep(1) self.renren.users_search(self.key,self.curpage+(self.nWhichThread - 1)*self.nPreThPageCount) elif self.index == 2: #twitter_api try: self.api_twitter.Search_users(q=self.key,page=self.curpage+(self.nWhichThread - 1)*self.nPreThPageCount) except Exception,e: print "-------------------twitter error",e pass if(self.bIsChiThreadDead==True): print "kill","api",self.index,"thread",self.nWhichThread thread.exit() searchThread.lock.acquire() self.getPageCnt[0] += 1 searchThread.lock.release() last=time.time() #print "Api",self.index,"Thread",self.nWhichThread,"page",self.curpage,"use time",last-now,'all page:',self.getPageCnt[0] self.curpage += 1
def run(self, index, page_pre_td, type): if type == 1: sina_api = sina_sdk.myapi() start = 1 + (index - 1) * self.prepg end = start + page_pre_td for i in range(start, end): if self.bTmExit: print "*** weibo: td", index, "is dead." WeiboMulTd.pages_got += end - start - i thread.exit() print "*** weibo: td", index, "page ", i, "is working." if sina_api.trends_status(self.key, i) == 'iseeu_nodata_again': print "*** weibo: td", index, "is dead." WeiboMulTd.pages_got += end - start - i thread.exit() WeiboMulTd.lock.acquire() WeiboMulTd.pages_got += 1 if (self.pages <= WeiboMulTd.pages_got): self.bTmExit = True WeiboMulTd.lock.release() print "*** weibo: td", index, "finish it's work." elif type == 2: twitter_api = twitter.Api() start = 1 + (index - 1) * self.prepg end = start + page_pre_td for i in range(start, end): if self.bTmExit: print "***twitter_status: td", index, "is dead." thread.exit() print "*** twitter_status: td", index, "page ", i, "is working." twitter_kong = None try: #print repr(self.key) twitter_kong = twitter_api.Search_status(q=self.key, page=i) except Exception, e: print "twitter failed error:", e pass if twitter_kong == "kong": WeiboMulTd.pages_got += end - start - i thread.exit() WeiboMulTd.lock.acquire() WeiboMulTd.pages_got += 1 if (self.pages <= WeiboMulTd.pages_got): self.bTmExit = True WeiboMulTd.lock.release() print "*** twitter_status: td", index, "finish it's work."
def run (self, index, page_pre_td, type): if type == 1: sina_api = sina_sdk.myapi() start = 1 + (index-1)*self.prepg end = start + page_pre_td for i in range(start, end): if self.bTmExit: print "*** weibo: td", index, "is dead." WeiboMulTd.pages_got += end-start-i thread.exit() print "*** weibo: td", index, "page ", i, "is working." if sina_api.trends_status(self.key, i) == 'iseeu_nodata_again': print "*** weibo: td", index, "is dead." WeiboMulTd.pages_got += end-start-i thread.exit() WeiboMulTd.lock.acquire() WeiboMulTd.pages_got += 1 if(self.pages <= WeiboMulTd.pages_got): self.bTmExit = True WeiboMulTd.lock.release() print "*** weibo: td", index, "finish it's work." elif type == 2: twitter_api = twitter.Api() start = 1 + (index-1)*self.prepg end = start + page_pre_td for i in range(start, end): if self.bTmExit: print "***twitter_status: td", index, "is dead." thread.exit() print "*** twitter_status: td", index, "page ", i, "is working." twitter_kong = None try: #print repr(self.key) twitter_kong=twitter_api.Search_status(q=self.key,page=i) except Exception,e: print "twitter failed error:",e pass if twitter_kong=="kong": WeiboMulTd.pages_got += end-start-i thread.exit() WeiboMulTd.lock.acquire() WeiboMulTd.pages_got += 1 if(self.pages <= WeiboMulTd.pages_got): self.bTmExit = True WeiboMulTd.lock.release() print "*** twitter_status: td", index, "finish it's work."
def OnCount(self): tmPre = [] if self.sur == "sina.com.cn": sinaapi = sina_sdk.myapi() tmPre = sinaapi.statistiek_of_statustime(self.id) elif self.sur == "renren.com": pass frame = self.moreinfoLB.tj for i in range(12): sta = frame.stas[i] sta.SetSize((40, tmPre[i]*400)) sta.SetPosition((20+i*45+5, 450-tmPre[i]*400+10)) stt = frame.stav[i] stt.SetPosition((25+i*45, 450-tmPre[i]*400-5)) if tmPre[i]<>0: cnt = str(tmPre[i]*100) cnt = cnt[:cnt.find('.')+3] stt.SetLabel(cnt)
def OnCount(self): tmPre = [] if self.sur == "sina.com.cn": sinaapi = sina_sdk.myapi() tmPre = sinaapi.statistiek_of_statustime(self.id) elif self.sur == "renren.com": pass frame = self.moreinfoLB.tj for i in range(12): sta = frame.stas[i] sta.SetSize((40, tmPre[i] * 400)) sta.SetPosition((20 + i * 45 + 5, 450 - tmPre[i] * 400 + 10)) stt = frame.stav[i] stt.SetPosition((25 + i * 45, 450 - tmPre[i] * 400 - 5)) if tmPre[i] <> 0: cnt = str(tmPre[i] * 100) cnt = cnt[:cnt.find('.') + 3] stt.SetLabel(cnt)
def __init__(self,parent,id,source, sid=None): wx.Frame.__init__(self,parent,title=Eng2Zh("iSeeu详细信息"),size=(750,650),pos=(300,50), style=wx.DEFAULT_FRAME_STYLE^(wx.MAXIMIZE_BOX|wx.RESIZE_BORDER)) self.SetBackgroundColour((250,250,250)) self.SetIcon(wx.Icon('image/icon.ico', wx.BITMAP_TYPE_ICO)) if source == "sina.com.cn": self.moreinfoLB = MoreInfo.iSeeuMoreLB(self) elif source == "renren.com": self.moreinfoLB = MoreInfo.iSeeuMoreLB(self, 2) self.name=wx.StaticText(self,label=Eng2Zh("姓名:")) self.nameval=wx.StaticText(self) self.ID=wx.StaticText(self,label="I D:") self.idval=wx.StaticText(self) self.sex=wx.StaticText(self,label=Eng2Zh("性别:")) self.sexval=wx.StaticText(self) self.province=wx.StaticText(self,label=Eng2Zh("省份:")) self.provinceval=wx.StaticText(self) self.city=wx.StaticText(self,label=Eng2Zh("城市:")) self.cityval=wx.StaticText(self) self.domain = wx.StaticText(self,label=Eng2Zh("网站:")) self.domainval = wx.StaticText(self) #self.Bind(wx.EVT_CLOSE, self.__repr__, self) #不同 if source == "sina.com.cn": self.description = wx.StaticText(self,label=Eng2Zh("描述:")) self.descriptionval = wx.StaticText(self) self.status = wx.StaticText(self,label=Eng2Zh("状态:")) self.statusval = wx.StaticText(self) self.regtime = wx.StaticText(self,label=Eng2Zh("注册于:")) self.regtimeval = wx.StaticText(self) self.friendcnt = 0 elif source == "renren.com": self.birth = wx.StaticText(self,label=Eng2Zh("生 日:")) self.birthval = wx.StaticText(self) self.country = wx.StaticText(self,label=Eng2Zh("国 家:")) self.countryval = wx.StaticText(self) self.workplace = wx.StaticText(self,label=Eng2Zh("工作地点:")) self.workplaceval = wx.StaticText(self) self.workdes = wx.StaticText(self,label=Eng2Zh("工作描述:")) self.workdesval = wx.StaticText(self) self.wstime = wx.StaticText(self,label=Eng2Zh("开始时间:")) self.wstimeval = wx.StaticText(self) self.wetime = wx.StaticText(self,label=Eng2Zh("结束时间:")) self.wetimeval = wx.StaticText(self) self.gsch = wx.StaticText(self,label=Eng2Zh("毕业学校:")) self.gschval = wx.StaticText(self) self.gtime = wx.StaticText(self,label=Eng2Zh("毕业时间:")) self.gtimeval = wx.StaticText(self) #获得数据 if sid: #获取数据 sinaapi = sina_sdk.myapi() sinaapi.search_user_byid(id) self.data = None #print "data",self.data if source == "sina.com.cn": self.sqlite_op=sqlite_op.sqlite_op() self.data=self.sqlite_op.searchById(id) self.data=self.data[0] self.domainval.SetLabel(self.data[6]) des = self.data[7] if len(des)>41: des=des[:41]+"..." self.descriptionval.SetLabel(des) #print type(self.data[8]),self.data[8] sta = self.data[8] if sta==None: sta=' ' else: if len(sta)>41: sta=sta[:41]+"..." self.statusval.SetLabel(sta) self.regtimeval.SetLabel(self.data[9]) self.friendcnt = self.data[10] self.nameval.SetLabel(self.data[0]) self.idval.SetLabel(str(self.data[1])) self.sexval.SetLabel(self.data[2]) self.provinceval.SetLabel(self.data[3]) self.cityval.SetLabel(self.data[4]) self.domainval.SetLabel(Eng2Zh('新浪网')+'sina.com.cn') elif source == "renren.com": rensql = sql_renren.renren_sql() self.data = rensql.get_all_value(id) self.domainval.SetLabel(Eng2Zh('人人网')+'renren.com') self.nameval.SetLabel(self.data[1]) self.idval.SetLabel(str(self.data[2])) self.sexval.SetLabel(self.data[3]) self.birthval.SetLabel(self.data[4]) self.countryval.SetLabel(self.data[6]) self.provinceval.SetLabel(self.data[7]) self.cityval.SetLabel(self.data[8]) self.workplaceval.SetLabel(self.data[9]) self.workdesval.SetLabel(self.data[10]) self.wstimeval.SetLabel(self.data[11]) self.wetimeval.SetLabel(self.data[12]) self.gschval.SetLabel(self.data[13]) self.gtimeval.SetLabel(self.data[14]) #print "data",self.data img = wx.Image("image/python_kj.jpg",wx.BITMAP_TYPE_ANY) self.img=wx.StaticBitmap(self,-1,wx.BitmapFromImage(img)) #---------------1 行---------------- #---------------1 行 1 列----------- hbox1 = wx.BoxSizer() hbox1.Add(self.img, 0, wx.ALL, 5) #---------------1 行 2 列----------- if source == "sina.com.cn": box_all = wx.BoxSizer(wx.VERTICAL) hbox12=wx.FlexGridSizer(2,6,5,5) #wx.BoxSizer() hbox12.AddMany([(self.name,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT),(self.nameval,0,wx.ALIGN_LEFT|wx.ALIGN_BOTTOM), (self.ID,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT),(self.idval,0,wx.ALIGN_LEFT|wx.ALIGN_BOTTOM), (self.sex,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT),(self.sexval,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT), (self.province,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT),(self.provinceval,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT), (self.city,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT),(self.cityval,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT), (self.domain,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT),(self.domainval,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT) ]) box_cd = wx.BoxSizer() box_cd.AddMany([(self.description,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT),(self.descriptionval,1,wx.ALIGN_LEFT|wx.ALIGN_RIGHT|wx.EXPAND,5)]) box_cs = wx.BoxSizer() box_cs.AddMany([(self.status,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT),(self.statusval,1,wx.ALIGN_LEFT|wx.ALIGN_RIGHT|wx.EXPAND,5)]) box_cr = wx.BoxSizer() box_cr.AddMany([(self.regtime,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT),(self.regtimeval,1,wx.ALIGN_LEFT|wx.ALIGN_RIGHT|wx.EXPAND,5)]) box_all.AddMany([(hbox12,0,(wx.ALL^wx.TOP)|wx.EXPAND,5),(box_cd,0,wx.ALL|wx.EXPAND,5), (box_cs,0,wx.ALL|wx.EXPAND,5),(box_cr,0,wx.ALL|wx.EXPAND,5)]) hbox1.Add(box_all, 0, wx.EXPAND | wx.ALL,5) elif source == "renren.com": hbox12=wx.FlexGridSizer(5,6,5,5) hbox12.AddMany([(self.name,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT),(self.nameval,0,wx.ALIGN_LEFT|wx.ALIGN_BOTTOM), (self.ID,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT),(self.idval,0,wx.ALIGN_LEFT|wx.ALIGN_BOTTOM), (self.sex,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT),(self.sexval,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT), (self.country,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT),(self.countryval,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT), (self.province,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT),(self.provinceval,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT), (self.city,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT),(self.cityval,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT), (self.birth,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT),(self.birthval,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT), (self.domain,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT),(self.domainval,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT), (self.workdes,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT),(self.workdesval,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT), (self.workplace,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT),(self.workplaceval,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT), (self.wstime,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT),(self.wstimeval,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT), (self.wetime,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT),(self.wetimeval,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT), (self.gsch,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT),(self.gschval,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT), (self.gtime,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT),(self.gtimeval,0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT), ((1,1),0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT),((1,1),0,wx.ALIGN_BOTTOM|wx.ALIGN_LEFT) ]) hbox1.Add(hbox12, 0, wx.EXPAND | wx.ALL,5) #---------------2 行---------------- vbox=wx.BoxSizer(wx.VERTICAL) vbox.Add(hbox1,proportion=0,flag=wx.ALL|wx.EXPAND,border=5) vbox.Add(self.moreinfoLB,proportion=1,flag=wx.EXPAND | wx.ALL,border=0) self.SetSizer(vbox) self.sid = sid self.id = id self.sur = source self.timer = wx.Timer(self,10) self.timer.Start(1) self.Bind(wx.EVT_TIMER,self.GetImage) self.Show()
def __init__(self, parent, id, source, sid=None): wx.Frame.__init__(self, parent, title=Eng2Zh("iSeeu详细信息"), size=(750, 650), pos=(300, 50), style=wx.DEFAULT_FRAME_STYLE ^ (wx.MAXIMIZE_BOX | wx.RESIZE_BORDER)) self.SetBackgroundColour((250, 250, 250)) self.SetIcon(wx.Icon('image/icon.ico', wx.BITMAP_TYPE_ICO)) if source == "sina.com.cn": self.moreinfoLB = MoreInfo.iSeeuMoreLB(self) elif source == "renren.com": self.moreinfoLB = MoreInfo.iSeeuMoreLB(self, 2) self.name = wx.StaticText(self, label=Eng2Zh("姓名:")) self.nameval = wx.StaticText(self) self.ID = wx.StaticText(self, label="I D:") self.idval = wx.StaticText(self) self.sex = wx.StaticText(self, label=Eng2Zh("性别:")) self.sexval = wx.StaticText(self) self.province = wx.StaticText(self, label=Eng2Zh("省份:")) self.provinceval = wx.StaticText(self) self.city = wx.StaticText(self, label=Eng2Zh("城市:")) self.cityval = wx.StaticText(self) self.domain = wx.StaticText(self, label=Eng2Zh("网站:")) self.domainval = wx.StaticText(self) #self.Bind(wx.EVT_CLOSE, self.__repr__, self) #不同 if source == "sina.com.cn": self.description = wx.StaticText(self, label=Eng2Zh("描述:")) self.descriptionval = wx.StaticText(self) self.status = wx.StaticText(self, label=Eng2Zh("状态:")) self.statusval = wx.StaticText(self) self.regtime = wx.StaticText(self, label=Eng2Zh("注册于:")) self.regtimeval = wx.StaticText(self) self.friendcnt = 0 elif source == "renren.com": self.birth = wx.StaticText(self, label=Eng2Zh("生 日:")) self.birthval = wx.StaticText(self) self.country = wx.StaticText(self, label=Eng2Zh("国 家:")) self.countryval = wx.StaticText(self) self.workplace = wx.StaticText(self, label=Eng2Zh("工作地点:")) self.workplaceval = wx.StaticText(self) self.workdes = wx.StaticText(self, label=Eng2Zh("工作描述:")) self.workdesval = wx.StaticText(self) self.wstime = wx.StaticText(self, label=Eng2Zh("开始时间:")) self.wstimeval = wx.StaticText(self) self.wetime = wx.StaticText(self, label=Eng2Zh("结束时间:")) self.wetimeval = wx.StaticText(self) self.gsch = wx.StaticText(self, label=Eng2Zh("毕业学校:")) self.gschval = wx.StaticText(self) self.gtime = wx.StaticText(self, label=Eng2Zh("毕业时间:")) self.gtimeval = wx.StaticText(self) #获得数据 if sid: #获取数据 sinaapi = sina_sdk.myapi() sinaapi.search_user_byid(id) self.data = None #print "data",self.data if source == "sina.com.cn": self.sqlite_op = sqlite_op.sqlite_op() self.data = self.sqlite_op.searchById(id) self.data = self.data[0] self.domainval.SetLabel(self.data[6]) des = self.data[7] if len(des) > 41: des = des[:41] + "..." self.descriptionval.SetLabel(des) #print type(self.data[8]),self.data[8] sta = self.data[8] if sta == None: sta = ' ' else: if len(sta) > 41: sta = sta[:41] + "..." self.statusval.SetLabel(sta) self.regtimeval.SetLabel(self.data[9]) self.friendcnt = self.data[10] self.nameval.SetLabel(self.data[0]) self.idval.SetLabel(str(self.data[1])) self.sexval.SetLabel(self.data[2]) self.provinceval.SetLabel(self.data[3]) self.cityval.SetLabel(self.data[4]) self.domainval.SetLabel(Eng2Zh('新浪网') + 'sina.com.cn') elif source == "renren.com": rensql = sql_renren.renren_sql() self.data = rensql.get_all_value(id) self.domainval.SetLabel(Eng2Zh('人人网') + 'renren.com') self.nameval.SetLabel(self.data[1]) self.idval.SetLabel(str(self.data[2])) self.sexval.SetLabel(self.data[3]) self.birthval.SetLabel(self.data[4]) self.countryval.SetLabel(self.data[6]) self.provinceval.SetLabel(self.data[7]) self.cityval.SetLabel(self.data[8]) self.workplaceval.SetLabel(self.data[9]) self.workdesval.SetLabel(self.data[10]) self.wstimeval.SetLabel(self.data[11]) self.wetimeval.SetLabel(self.data[12]) self.gschval.SetLabel(self.data[13]) self.gtimeval.SetLabel(self.data[14]) #print "data",self.data img = wx.Image("image/python_kj.jpg", wx.BITMAP_TYPE_ANY) self.img = wx.StaticBitmap(self, -1, wx.BitmapFromImage(img)) #---------------1 行---------------- #---------------1 行 1 列----------- hbox1 = wx.BoxSizer() hbox1.Add(self.img, 0, wx.ALL, 5) #---------------1 行 2 列----------- if source == "sina.com.cn": box_all = wx.BoxSizer(wx.VERTICAL) hbox12 = wx.FlexGridSizer(2, 6, 5, 5) #wx.BoxSizer() hbox12.AddMany([ (self.name, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.nameval, 0, wx.ALIGN_LEFT | wx.ALIGN_BOTTOM), (self.ID, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.idval, 0, wx.ALIGN_LEFT | wx.ALIGN_BOTTOM), (self.sex, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.sexval, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.province, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.provinceval, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.city, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.cityval, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.domain, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.domainval, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT) ]) box_cd = wx.BoxSizer() box_cd.AddMany([(self.description, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.descriptionval, 1, wx.ALIGN_LEFT | wx.ALIGN_RIGHT | wx.EXPAND, 5)]) box_cs = wx.BoxSizer() box_cs.AddMany([(self.status, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.statusval, 1, wx.ALIGN_LEFT | wx.ALIGN_RIGHT | wx.EXPAND, 5)]) box_cr = wx.BoxSizer() box_cr.AddMany([(self.regtime, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.regtimeval, 1, wx.ALIGN_LEFT | wx.ALIGN_RIGHT | wx.EXPAND, 5)]) box_all.AddMany([(hbox12, 0, (wx.ALL ^ wx.TOP) | wx.EXPAND, 5), (box_cd, 0, wx.ALL | wx.EXPAND, 5), (box_cs, 0, wx.ALL | wx.EXPAND, 5), (box_cr, 0, wx.ALL | wx.EXPAND, 5)]) hbox1.Add(box_all, 0, wx.EXPAND | wx.ALL, 5) elif source == "renren.com": hbox12 = wx.FlexGridSizer(5, 6, 5, 5) hbox12.AddMany([ (self.name, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.nameval, 0, wx.ALIGN_LEFT | wx.ALIGN_BOTTOM), (self.ID, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.idval, 0, wx.ALIGN_LEFT | wx.ALIGN_BOTTOM), (self.sex, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.sexval, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.country, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.countryval, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.province, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.provinceval, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.city, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.cityval, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.birth, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.birthval, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.domain, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.domainval, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.workdes, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.workdesval, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.workplace, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.workplaceval, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.wstime, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.wstimeval, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.wetime, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.wetimeval, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.gsch, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.gschval, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.gtime, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), (self.gtimeval, 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), ((1, 1), 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT), ((1, 1), 0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT) ]) hbox1.Add(hbox12, 0, wx.EXPAND | wx.ALL, 5) #---------------2 行---------------- vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(hbox1, proportion=0, flag=wx.ALL | wx.EXPAND, border=5) vbox.Add(self.moreinfoLB, proportion=1, flag=wx.EXPAND | wx.ALL, border=0) self.SetSizer(vbox) self.sid = sid self.id = id self.sur = source self.timer = wx.Timer(self, 10) self.timer.Start(1) self.Bind(wx.EVT_TIMER, self.GetImage) self.Show()