在下面的代码中,第一个对话框立即获得焦点,因此用户可以键入答案并按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)