如何在tkinter python中设置用户名和密码 [英] how to make a set username and password in tkinter python
本文介绍了如何在tkinter python中设置用户名和密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在tk inter中,他们可以使用特定的用户名和密码打开特定的文件,就像管理员登录后将其带到管理员页面一样.
In tk inter is their away to make a specific username and password open a specific file like if an administrator logs in he would be taken to a administrator page.
from Tkinter import *
root = Tk()
w = Label(root, text="LiftServer(Sign-in)")
w.pack()
e1 = Label(root, text="******************************")
e1.pack()
w1 = Label(root, text="Username")
w1.pack()
e = Entry(root)
e.pack()
w2 = Label(root, text="Password")
w2.pack()
e1 = Entry(root)
e1.pack()
toolbar = Frame(root)
b = Button(toolbar, text="Enter", width=9)
b.pack(side=LEFT, padx=2, pady=2)
b = Button(toolbar, text="Cancel", width=9)
b.pack(side=LEFT, padx=2, pady=2)
def callback():
execfile("signup.txt")
b = Button(toolbar, text="Sign-Up", command=callback, width=9)
b.pack(side=LEFT, padx=2, pady=2)
toolbar.pack(side=TOP, fill=X)
mainloop()
推荐答案
不能完全确定您要问的是什么,但我认为这可以解决..
not entirely sure what you are asking but I think this answers it ..
def callback():
if w.get() == "Bob" and w2.get() == "password":
openfile('file1')
else:
openfile('file2')
这篇关于如何在tkinter python中设置用户名和密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文