← 返回首页
状态:已完成

【Python 代码】获取当前窗口尺寸和像素比状态

import tkinter as tk root = tk.Tk() root.update_idletasks() width = root.winfo_width() height = root.winfo_height() pixel_ratio = root.winfo_fpixels('1x1') print(f"Width: {width}, Height: {height}, Pixel Ratio: {pixel_ratio}")