Py学习  »  Python

Tkinter SimpleDialog Box无法在使用python3的Windows 10中获得焦点

mgroat • 5 年前 • 1456 次点击  

在下面的代码中,第一个对话框立即获得焦点,因此用户可以键入答案并按Enter。在第二个版本中,在windows中运行时似乎不会发生这种情况。运行Raspbian9,两个窗口打开时都会聚焦。

有没有什么方法可以让两个窗口在Windows打开时得到焦点?

import tkinter as tk
from tkinter import simpledialog

root = tk.Tk()
root.withdraw()

answer1 = simpledialog.askstring("Test1","This one gets focus when it opens",parent=root)
answer2 = simpledialog.askstring("Test2","This one doesn't",parent=root)
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/43593
 
1456 次点击  
文章 [ 1 ]  |  最新文章 5 年前