【问题标题】:How to preview text in tkinter entry (Python) [duplicate]如何在 tkinter 条目中预览文本(Python)[重复]
【发布时间】:2020-06-17 06:33:03
【问题描述】:

那么,在我的用户在文本框中输入任何内容之前,我该如何做到这一点,它会显示“输入您的姓名”或类似内容的预览? e.g.

userName = Entry(text="Username", font = ('Arial', 15), bg = 'white').place(relx = 0.55, rely = 0.35)
#userName.insert(0, "User name")
password = Entry(text="Password", font = ('Arial', 15), bg = 'white',show = '•').place(relx = 0.55, rely = 0.43)
#password.insert(0, "Password")

【问题讨论】:

    标签: python tkinter


    【解决方案1】:

    试试这个:

    text = Text(parent, width=40, height=10)
    text.insert('1.0', 'here is my text to insert')
    

    欲了解更多信息,请参阅:the tk docs

    【讨论】:

    • 谢谢,但它说 nonetype 没有属性插入
    • 没有看到你的代码很难提供帮助。编辑您的问题或提出新问题。
    • ok 编辑了问题
    • 先插入后放置可能会成功。
    • 但是我怎么做到的,所以当他们开始输入它时它会消失,而且对于密码的东西我希望它不显示他们输入的内容,所以插入并不真正适用
    猜你喜欢
    • 2014-12-16
    • 2022-09-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-27
    • 2018-01-01
    相关资源
    最近更新 更多