问题
我已经为秒表编写了代码。其中有一个重置秒表的功能。为此:我首先销毁当前窗口,然后创建一个新窗口。但在此过程中,窗口失去了键盘焦点。如何强制新窗口具有键盘焦点?
代码
def reset(self,event=None):
self.quitwin() ##Closing the window that is open now
self.__init__() ##Creating a new window
def quitwin(self,event=None):
self.window.destroy()
规格Python 2.7
如果有人能指出更好的实施方式(例如清除当前窗口并再次编写内容),我将不胜感激。