简体   繁体   English

Tkinter中的顶级小部件

[英]Toplevel widgets in Tkinter

I have a Toplevel widget I'd like it so that it would never appear within the confines of the main Tk window. 我有一个我想要的顶级小部件,因此它永远不会出现在Tk主窗口的范围内。 Basically so that when the Toplevel appears it doesn't cover up any of the main Tk window. 基本上,这样一来,当出现“顶级”时,它不会掩盖任何Tk主窗口。

您想使用wm_geometry和一点点数学来计算和设置第二个顶层的合适起始位置。

You could just set up a separate toplevel, cf: 您可以只设置一个单独的顶层,参见:

self.newwindow = Toplevel(self)
self.newwindow.title('New Window')

and then embed the widget in the separate toplevel. 然后将小部件嵌入单独的顶层。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM