如何在 Tkinter 中获取屏幕尺寸? [英] How to get the screen size in Tkinter?

查看:46
本文介绍了如何在 Tkinter 中获取屏幕尺寸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以使用 tkinter 计算屏幕尺寸.

I would like to know if it is possible to calculate the screen size using tkinter.

我想要这个,这样可以让程序在屏幕中央打开...

I wanted this so that can make the program open up in the center of the screen...

推荐答案

import tkinter as tk

root = tk.Tk()

screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()

这篇关于如何在 Tkinter 中获取屏幕尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆