Python 如何使用 Tkinter 获取 Windows 当前大小?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4065783/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 14:04:54  来源:igfitidea点击:

How do I get a windows current size using Tkinter?

pythontkinter

提问by rectangletangle

How do I get a windows current size using Tkinter, or possibly with the python standard library?

如何使用 Tkinter 或可能使用 python 标准库获取 Windows 当前大小?

采纳答案by Gary Kerr

Use the following universal widget methods (where wis a widget):

使用以下通用小部件方法(其中w是小部件):

w.winfo_height()
w.winfo_width()

You can also use the following:

您还可以使用以下内容:

w.winfo_reqheight()
w.winfo_reqwidth()

Read about universal widget methods.

阅读通用小部件方法