def __init__(self,conf_name): wx.Frame.__init__(self,None,-1,"create database",size=(460,320)) print "searching" self.Namelist=confs.getConfName(conf_name) print "searching finish!" print self.Namelist lens=len(self.Namelist) self.grid1=wx.grid.Grid(self,-1) self.grid1.CreateGrid(lens, 1) self.grid1.SetColLabelValue(0,"Name") self.grid1.SetRowLabelSize(40) self.grid1.SetColSize(0,420) row=0 for key in range(lens): self.grid1.SetRowLabelValue(row,str(row+1)) self.grid1.SetCellValue(row,0,self.Namelist[key][0]) row+=1 # 表格的事件 self.grid1.Bind(grid.EVT_GRID_CELL_LEFT_CLICK, self.OnCellLeftClick) # 当单击鼠标左键时触发 self.Show()
def OnHide(self,evt): self.text.Show(False) self.inputText2.Show(False) self.inputkey.Show(False) self.bt2.Show(False) font=wx.Font(12,wx.DEFAULT,wx.NORMAL,wx.NORMAL,True) font2=wx.Font(16,wx.DEFAULT,wx.NORMAL,wx.NORMAL,False) self.searchflag=wx.StaticText(MyFrame.searchpage,-1,"searching...",(550,170),(630,25)) self.searchflag.SetForegroundColour((255,145,0)) self.searchflag.SetFont(font2) self.Namelist=confs.getConfName(self.inputText1.GetValue()) self.searchflag.Show(False) MyFrame.searchpage.Show(False) self.List={} self.bt={} for i in range(len(self.Namelist)): self.List[i]=wx.TextCtrl(MyFrame.searchpage,-1,self.Namelist[i][0],(250,70+i*30),(630,25)) self.List[i].SetForegroundColour((30,130,230)) self.List[i].SetFont(font) for j in range(len(self.Namelist)): self.bt[j]=wx.Button(MyFrame.searchpage,-1,"ENTER",(900,70+j*30),(80,25),name=self.Namelist[j][1]) self.bt[j].Bind(wx.EVT_BUTTON,self.OnEnter) MyFrame.searchpage.Show(True)
def run(self): confs.getConfName(self.shortname)