What is the simplest way to get monitor resolution (preferably in a tuple)?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
To get bits per pixel:
parameters in gdi32:
Old question but this is missing. I'm new to python so please tell me if this is a "bad" solution. This solution is supported for windows and mac only and it works just for the main screen - but the os is not mentioned in the question.
Measure the size by taking a screenshot. As the screensize should not change this has to be done only once. There are more elegant solutions if you have a gui toolkit like gtk, wx, ... installed.
see Pillow
Here is a quick little Python program that will display the information about your multi-monitor setup:
Here's an example of its output:
If you are using the
Qt
toolkit specificallyPySide
, you can do the following:I created a PyPI module for this reason:
The code:
Result:
It supports multi monitor environments. Its goal is to be cross platform; for now it supports Cygwin and X11 but pull requests are totally welcome.
XWindows version: