def LoginButton(self, event): #连接cara_sale数据库 op = Sql_operation("car_sale") #获取users表中的用户名和密码信息,返回为二维元组 np = op.FindAll("user") #匹配标记 login_sign = 0 #匹配用户名和密码 for i in np: if (i[1] == self.user_name.GetValue()) and ( i[2] == self.user_password.GetValue()): login_sign = 1 if i[1]=='custom': login_sign=2 print(login_sign) print(i[1]) print(i[2]) break if login_sign == 0: self.showinfo.AppendText("用户名或密码错误!") elif login_sign == 1: print("登录成功!") operation = Maner(None, title="信息管理", size=(1024, 668)) operation.Show() self.Close(True) elif login_sign==2: print("登陆成功") operation=CustomManer(None,title="客户界面",size=(1024,668)) operation.Show() self.Close(True)
def OnLabelleftClick(self, event): #连接car_sale数据库 op = Sql_operation("car_sale") np = op.FindAll("custom") print("RowIdx: {0}".format(event.GetRow())) print("ColIdx: {0}".format(event.GetRow())) print(np[event.GetRow()]) event.Skip()
def CreateGrid(self): #连接car_sale数据库 op = Sql_operation("car_sale") #获取custom表中的学生信息,返回为二维元组 np = op.FindAll("custom") column_names = ("客户姓名", "年龄", "性别", "联系方式", "业务记录") cgrid = wx.grid.Grid(self.pnl) cgrid.CreateGrid(len(np), len(np[0])) for row in range(len(np)): #表格横向为对应表中的属性,纵向为首个属性的数据 cgrid.SetRowLabelValue(row, str(np[row][0])) for col in range(1, len(np[row])): cgrid.SetColLabelValue(col - 1, column_names[col]) cgrid.SetCellValue(row, col - 1, str(np[row][col])) cgrid.AutoSize() return cgrid
def CreateGrid(self): #连接car_sale数据库 op = Sql_operation("car_sale") #获取car表中的学生信息,返回为二维元组 np = op.FindAll("employ") column_names = ("员工编号","员工姓名","年龄","性别","籍贯","学历") cgrid = wx.grid.Grid(self.pnl) #CreateGrid(行数,列数) cgrid.CreateGrid(len(np),len(np[0])-1) for row in range(len(np)): #表格横向为对应表中的属性,纵向为首个属性的数据 cgrid.SetRowLabelValue(row,str(np[row][0])) for col in range(1,len(np[row])): cgrid.SetColLabelValue(col-1,column_names[col]) cgrid.SetCellValue(row,col-1,str(np[row][col])) cgrid.AutoSize() return cgrid
def CreateGrid(self): #连接car_sale数据库 op = Sql_operation("car_sale") #获取car表中的学生信息,返回为二维元组 np = op.FindAll("sale") column_types = ("销售编号", "车辆编号", "销售车型", "车辆颜色", "销售日期", "销售数量", "销售员", "买家") cgrid = wx.grid.Grid(self.pnl) #CreateGrid(行数,列数) cgrid.CreateGrid(len(np), len(np[0]) - 1) for row in range(len(np)): #表格横向为对应表中的属性,纵向为首个属性的数据 #row[0]要显示的为第一列 cgrid.SetRowLabelValue(row, str(np[row][0])) for col in range(1, len(np[row])): cgrid.SetColLabelValue(col - 1, column_types[col]) cgrid.SetCellValue(row, col - 1, str(np[row][col])) cgrid.AutoSize() return cgrid