【发布时间】:2020-10-28 13:15:44
【问题描述】:
我有一个带有 GUI 的应用程序,它要求用户通过 Tk Askstring 进行输入,如下所示...
a = askstring('ABC', 'Please enter something!')
如果用户单击对话框外,打开对话框时会遇到问题,它会将焦点带到根 GUI 并将对话框发送到后面。
这是 GUI 设置...
# GUI Attributes
root = tk.Tk()
root.geometry('800x480')
root.resizable(0, 0)
root.config(cursor='none')
root.title('')
root.wm_attributes('-type', 'splash')
有没有办法为 askstring 对话框设置焦点,这样就不会发生这种情况?
【问题讨论】:
-
提供minimal reproducible example,因为我无法重现您的问题。
-
我已经添加了根设置,这是在树莓派上运行的
标签: python python-3.x user-interface tkinter dialog