部分效果图:
部分源码:
def creatPage(self):self.addPage = AddFrame(self.root)#录入界面self.deletePage = DeleteFrame(self.root) #删除界面self.countPage = CountFrame(self.root) #统计界面self.register_admirPage = Register_admirFrame(self.root) #添加新管理员界面self.addPage.pack()#默认录入界面menubar = Menu(self.root)menubar.add_command(label = '录入书籍',command = self.addData)menubar.add_command(label = '删除书籍',command = self.deleteData)menubar.add_command(label = '统计书籍',command = self.countData)menubar.add_command(label = '添加管理员',command = self.register_admirData)self.root['menu'] = menubar #设置菜单栏def addData(self):self.addPage.pack()self.deletePage.pack_forget()self.countPage.pack_forget()self.register_admirPage.pack_forget()def deleteData(self):self.addPage.pack_forget()self.deletePage.pack()self.countPage.pack_forget()self.register_admirPage.pack_forget()def countData(self):self.addPage.pack_forget()self.deletePage.pack_forget()self.countPage.pack()self.register_admirPage.pack_forget()def register_admirData(self):self.addPage.pack_forget()self.deletePage.pack_forget()self.countPage.pack_forget()self.register_admirPage.pack()
def loginCheck(self):name = self.username.get()password = self.password.get()f = open('login_true.txt')for line in f:str = line.strip()str2 = ','user_name = str[:str.index(str2)]pass_word = str[str.index(str2)+1:]if name == user_name and pass_word == password:temp = 1breakelse:temp = 0if temp == 1 :self.page.destroy()User_MainPage(self.root) elif temp == 0 :showinfo(title = '失败', message = '账号或密码错误,重新登录!')def admir_loginCheck(self):admir_name = self.username.get()admir_password = self.password.get()f1 = open('login_admir.txt')for line1 in f1:str = line1.strip()str1 = ','admir_name_txt = str[:str.index(str1)]admir_password_txt = str[str.index(str1)+1:]if admir_name == admir_name_txt and admir_password == admir_password_txt:temp = 3breakelse:temp = 4 if temp == 3:self.page.destroy()Admir_MainPage(self.root)elif temp == 4:showinfo(title='失败', message='账号或密码错误,重新登录!')
源码:图书管理系统