こんにちは、Tkinter() を使用して python で単一のログインを開発しています。ユーザーが正しくログインしたときに、ログイン UI が非表示になり、コンテンツ UI が表示されるようにしたいだけです...だから、UI を非表示にできると考えていました。または可視性が隠されますか?たとえば、私はこのコードを持っていました...
def httpGETCheck(username, password):
....
# assumed that the user is correct
if registeredUser:
# how can I hide or set visible is false to all the UI in the showLogin() Module
# and how can I show the showContent() UI or replaced the showContent() UI from showLogin() UI
class ContentUI():
def showContent(self, frame):
button1 = Button(frame, text="+", width=15, command=counterPlus)
button1.grid()
def showLogin(self, frame):
self.contentUI = ContentUI()
L1 = Label(frame, text="User Name")
L1.pack( side = LEFT)
L1.grid()
E1 = Entry(frame, bd =5)
E1.pack(side = RIGHT)
E1.grid()
L2 = Label(frame, text="Password")
L2.pack( side = LEFT)
L2.grid()
E2 = Entry(frame, bd =5, show="*")
E2.pack(side = RIGHT)
E2.grid()
submit = Button(frame, text="Login", width=15, command=lambda: httpGETCheck(E1.get(), E2.get()))
submit.grid()
class UIDisplay():
def play(self):
root = Tk()
root.title(title)
root.geometry(dimension)
app = Frame(root)
contentUI = ContentUI()
contentUI.showLogin(app)
app.grid()
root.mainloop()
ad = UIDisplay()
ad.play()