|
|

楼主 |
发表于 2019-3-17 15:18:48
|
显示全部楼层
你好,定义完整登陆和顶层窗口代码如下,错误显示列表没有定义,先谢谢大佬帮忙
from tkinter import *
class Login(object):
def __init__(self):
self.root = Tk()
self.root.title("**医药系统")
self.root.geometry('450x300')
self.bg_image = PhotoImage(file='cloud.png')
self.bg_label = Label(self.root,image=self.bg_image)
self.bg_label.place(x=0,y=0,relwidth=1,relheight=1)
self.canvas = Canvas(self.bg_label,height=150,width=300)
self.image_file = PhotoImage(file='cd.gif')
self.image = self.canvas.create_image(0,0,anchor='w',image=self.image_file)
self.canvas.pack(side='top')
self.label_account = Label(self.bg_label,text='account: ',)
self.label_account.place(x=80,y=170)
self.label_password = Label(self.bg_label,text='password:')
self.label_password.place(x=80,y=205)
self.input_account = Entry(self.bg_label,width='30')
self.input_account.place(x=150,y=170)
self.input_passeord = Entry(self.bg_label,width='30',show='*')
self.input_passeord.place(x=150,y=205)
self.login_button = Button(self.bg_label,text="login",command=self.backstage_interface)
self.login_button.place(x=140,y=235)
self.sigin_button = Button(self.bg_label,text="sigin",command=self.sigin_interface)
self.sigin_button.place(x=260,y=235)
list1 = [100,200,300,400]
def backstage_interface(self):
#self.root.destroy()
top = Toplevel(master=None)
top.geometry('200x100')
top.title("login demo")
act = self.input_account.get()
for each in list1():
if each == act:
msg = Message(top,text="成功")
else:
msg = Message(top,text="不存在该用户")
msg.pack() |
|