Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/349.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何设置';显示';tkinter条目中的参数设置为显示后的默认值="*&引用;?_Python_Tkinter_Tkinter Entry - Fatal编程技术网

Python 如何设置';显示';tkinter条目中的参数设置为显示后的默认值="*&引用;?

Python 如何设置';显示';tkinter条目中的参数设置为显示后的默认值="*&引用;?,python,tkinter,tkinter-entry,Python,Tkinter,Tkinter Entry,我正在用Tkinter制作一个GUI,其中“开始”菜单为用户提供了在学生帐户和管理员帐户之间切换的选项。对于学生来说,需要一个姓名,而对于管理员来说,需要一个密码,该密码可以输入到相同的输入框中。密码需要用星号(*)隐藏,因为这对于名称输入是不必要的 在从学生帐户切换到管理员帐户一次后,下次我要将学生帐户的输入框更改回正常文本视图。 这是我的代码的精简版本 admin = False def switchUser(): global admin if admin:

我正在用Tkinter制作一个GUI,其中“开始”菜单为用户提供了在学生帐户和管理员帐户之间切换的选项。对于学生来说,需要一个姓名,而对于管理员来说,需要一个密码,该密码可以输入到相同的输入框中。密码需要用星号(*)隐藏,因为这对于名称输入是不必要的

在从学生帐户切换到管理员帐户一次后,下次我要将学生帐户的输入框更改回正常文本视图。 这是我的代码的精简版本

admin = False
def switchUser():
    global admin
    if admin:
        admin = False
        userEntry.config(show='*')
        titleLabel.config(text='Enter the password')
    else:
        admin = True
        #code to switch back to default text view in entry box
        titleLabel.config(text='Enter your name')

titleLabel = Label(startMenu, text='Enter your name')
userEntry = Entry(startMenu)
adminButton = (startMenu, text='AdminYou can set the 
show
option to the empty string.

userEntry.configure(show="")
admin=False
def switchUser():
全局管理员
如果管理员:
admin=False
userEntry.config(show='*')
titleLabel.config(text='Enter the password')
其他:
admin=True
#在输入框中切换回默认文本视图的代码
titleLabel.config(text='Enter your name')
titleLabel=标签(开始菜单,text='Enter your name')
userEntry=Entry(开始菜单)

adminButton=(开始菜单,text='Admin您可以将
show
选项设置为空字符串


.config(show=“”)
另外,我认为您在
(startmenus,text='Admin')前面的最后一行缺少
按钮