【发布时间】:2021-02-09 20:51:19
【问题描述】:
无法完成下面给出的以下代码。我正在尝试创建一个用于输入密码的弹出窗口。如果密码正确,那么它应该完全运行代码。如果密码错误,那么它应该给出相同的弹出窗口并输入正确的密码。
from tkinter import *
root = Tk()
e = Entry(root, width=50)
e.pack()
def myClick():
password = "sunny567"
get = e.get()
if password == get:
myLabel = Label(root, text=get)
myLabel.pack()
else:
myLabel = Label(root, text="Entered Password is wrong. Please try again.")
myLabel.pack()
myButton = Button(root, text="Enter the password", command=myClick)
myButton.pack()
root.mainloop()
代码继续
【问题讨论】:
-
压痕看起来很破。可以修一下吗?
-
代码编辑过一次请检查。
标签: python tkinter passwords tkinter-canvas tkinter-entry