获取python中的屏幕大小

2024-06-06 22:42:27 发布

您现在位置:Python中文网/ 问答频道 /正文

Possible Duplicate:
How do I get Monitor resolution in Python?

我想知道是否有办法从python脚本中获得屏幕大小。

类似问题:

Getting monitor size in python

这个问题告诉你如何通过pygame。有没有办法只用python呢?我需要这些脚本在几个基于Unix的操作系统上运行。


Tags: in脚本sizeget屏幕dopygamemonitor
1条回答
网友
1楼 · 发布于 2024-06-06 22:42:27

我从Finding the workspace size (screen size less the taskbar) using GTK那里偷来的

import gtk, pygtk

window = gtk.Window()
screen = window.get_screen()
print "width = " + str(screen.get_width()) + ", height = " + str(screen.get_height())

只是让你知道,如果你有多个显示器屏幕的大小将是所有这些显示器在一起。

相关问题 更多 >