在python中获取屏幕大小

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3375740/
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 10:43:09  来源:igfitidea点击:

get screen size in python

pythonmonitor

提问by rabindo

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

可能的重复:
如何在 Python 中获得监视器分辨率?

I was wondering if there was a way to get the screen size from a python script.

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

Similar Questions:

类似问题:

Getting monitor size in python

在python中获取监视器大小

This question tells you how to get it through pygame. Is there a way to do it with just python? I need the scripts to run on several Unix-based operating system.

这个问题告诉你如何通过pygame获得它。有没有办法只用python来做到这一点?我需要脚本在几个基于 Unix 的操作系统上运行。

回答by Kevin S

I stole this from Finding the workspace size (screen size less the taskbar) using GTK

我从使用 GTK 查找工作区大小(屏幕大小减去任务栏)中窃取了这个

import gtk, pygtk

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

Just to let you know, if you have multiple monitors the screen's size will be all of those monitors together.

只是让您知道,如果您有多个显示器,则屏幕的大小将是所有这些显示器的总和。