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')