getmonitorresolution


Namegetmonitorresolution JSON
Version 0.13 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/getmonitorresolution
SummaryUses ctypes to get the resolution information of all available monitors
upload_time2023-05-19 10:28:13
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords ctypes monitor resolution
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Uses ctypes to get the resolution and other useful information of all available monitors

## pip install getmonitorresolution

#### Tested against Windows 10 / Python 3.10 / Anaconda

```python
The get_monitors_resolution() function retrieves the resolution information of all available monitors on a Windows machine. It takes an optional parameter dpi_awareness, which sets the DPI awareness level. The function returns a tuple containing two dictionaries, allmoni and moninfos.

allmoni is a dictionary containing the resolution details of all available monitors, with the monitor index as the key. The values of the dictionary are also dictionaries containing the width and height of each monitor.

moninfos is a dictionary containing the following resolution information of all the available monitors:

width_all_monitors: The combined width of all the monitors.
height_all_monitors: The maximum height among all the monitors.
max_monitor_width: The maximum width of all the monitors.
min_monitor_width: The minimum width of all the monitors.
max_monitor_height: The maximum height of all the monitors.
min_monitor_height: The minimum height of all the monitors.


def get_monitors_resolution(dpi_awareness=2):
    """
    Retrieves the resolution information of all the available monitors and returns the resolution details in a dictionary format.

    Args:
        dpi_awareness (int): Optional parameter to set DPI awareness level. Default is 2, which is the highest level of DPI awareness.

    Returns:
        tuple: A tuple containing two dictionaries, `allmoni` and `moninfos`.
        - `allmoni` (dict): A dictionary containing the resolution details of all available monitors, with the monitor index as key.
        - `moninfos` (dict): A dictionary containing the following resolution information of all the available monitors:
            * width_all_monitors (int): The combined width of all the monitors.
            * height_all_monitors (int): The maximum height among all the monitors.
            * max_monitor_width (int): The maximum width of all the monitors.
            * min_monitor_width (int): The minimum width of all the monitors.
            * max_monitor_height (int): The maximum height of all the monitors.
            * min_monitor_height (int): The minimum height of all the monitors.
			
			

from getmonitorresolution import get_monitors_resolution
eachmonitor,general = get_monitors_resolution()
print(eachmonitor)
print(general)

# output 
eachmonitor,general = get_monitors_resolution()
from pprint import pprint
pprint(eachmonitor)
{0: {'DeviceID': 'PCI\\VEN_10DE&DEV_1F06&Sxxxxxxxxxxxxxxxxx&REV_A1',
     'DeviceKey': '\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Video\\{xxxxxxxxxxxxxx}\\0000',
     'DeviceName': '\\\\.\\DISPLAY1',
     'DeviceString': 'NVIDIA GeForce RTX 2060 SUPER',
     'StateFlags': 5,
     'height': 1080,
     'height_mm': 299,
     'is_primary': True,
     'width': 1920,
     'width_mm': 531,
     'x': 0,
     'y': 0},
 1: {'DeviceID': 'PCI\\VEN_10DE&xxxxxxxx&xxxxxxxxxxxxx&REV_A1',
     'DeviceKey': '\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Video\\{xxxxxxxxxxxx}\\0001',
     'DeviceName': '\\\\.\\DISPLAY2',
     'DeviceString': 'NVIDIA GeForce RTX 2060 SUPER',
     'StateFlags': 1,
     'height': 1080,
     'height_mm': 299,
     'is_primary': False,
     'width': 1920,
     'width_mm': 531,
     'x': 1920,
     'y': 0}}
pprint(general)
{'height_all_monitors': 2160,
 'max_monitor_height': 1080,
 'max_monitor_width': 1920,
 'min_monitor_height': 1080,
 'min_monitor_width': 1920,
 'width_all_monitors': 3840}

```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/getmonitorresolution",
    "name": "getmonitorresolution",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "ctypes,monitor,resolution",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/27/66/a45d5696245d4c2f741e4a725a1adbb1c5e14e16b383cc630b77611bfd08/getmonitorresolution-0.13.tar.gz",
    "platform": null,
    "description": "# Uses ctypes to get the resolution and other useful information of all available monitors\r\n\r\n## pip install getmonitorresolution\r\n\r\n#### Tested against Windows 10 / Python 3.10 / Anaconda\r\n\r\n```python\r\nThe get_monitors_resolution() function retrieves the resolution information of all available monitors on a Windows machine. It takes an optional parameter dpi_awareness, which sets the DPI awareness level. The function returns a tuple containing two dictionaries, allmoni and moninfos.\r\n\r\nallmoni is a dictionary containing the resolution details of all available monitors, with the monitor index as the key. The values of the dictionary are also dictionaries containing the width and height of each monitor.\r\n\r\nmoninfos is a dictionary containing the following resolution information of all the available monitors:\r\n\r\nwidth_all_monitors: The combined width of all the monitors.\r\nheight_all_monitors: The maximum height among all the monitors.\r\nmax_monitor_width: The maximum width of all the monitors.\r\nmin_monitor_width: The minimum width of all the monitors.\r\nmax_monitor_height: The maximum height of all the monitors.\r\nmin_monitor_height: The minimum height of all the monitors.\r\n\r\n\r\ndef get_monitors_resolution(dpi_awareness=2):\r\n    \"\"\"\r\n    Retrieves the resolution information of all the available monitors and returns the resolution details in a dictionary format.\r\n\r\n    Args:\r\n        dpi_awareness (int): Optional parameter to set DPI awareness level. Default is 2, which is the highest level of DPI awareness.\r\n\r\n    Returns:\r\n        tuple: A tuple containing two dictionaries, `allmoni` and `moninfos`.\r\n        - `allmoni` (dict): A dictionary containing the resolution details of all available monitors, with the monitor index as key.\r\n        - `moninfos` (dict): A dictionary containing the following resolution information of all the available monitors:\r\n            * width_all_monitors (int): The combined width of all the monitors.\r\n            * height_all_monitors (int): The maximum height among all the monitors.\r\n            * max_monitor_width (int): The maximum width of all the monitors.\r\n            * min_monitor_width (int): The minimum width of all the monitors.\r\n            * max_monitor_height (int): The maximum height of all the monitors.\r\n            * min_monitor_height (int): The minimum height of all the monitors.\r\n\t\t\t\r\n\t\t\t\r\n\r\nfrom getmonitorresolution import get_monitors_resolution\r\neachmonitor,general = get_monitors_resolution()\r\nprint(eachmonitor)\r\nprint(general)\r\n\r\n# output \r\neachmonitor,general = get_monitors_resolution()\r\nfrom pprint import pprint\r\npprint(eachmonitor)\r\n{0: {'DeviceID': 'PCI\\\\VEN_10DE&DEV_1F06&Sxxxxxxxxxxxxxxxxx&REV_A1',\r\n     'DeviceKey': '\\\\Registry\\\\Machine\\\\System\\\\CurrentControlSet\\\\Control\\\\Video\\\\{xxxxxxxxxxxxxx}\\\\0000',\r\n     'DeviceName': '\\\\\\\\.\\\\DISPLAY1',\r\n     'DeviceString': 'NVIDIA GeForce RTX 2060 SUPER',\r\n     'StateFlags': 5,\r\n     'height': 1080,\r\n     'height_mm': 299,\r\n     'is_primary': True,\r\n     'width': 1920,\r\n     'width_mm': 531,\r\n     'x': 0,\r\n     'y': 0},\r\n 1: {'DeviceID': 'PCI\\\\VEN_10DE&xxxxxxxx&xxxxxxxxxxxxx&REV_A1',\r\n     'DeviceKey': '\\\\Registry\\\\Machine\\\\System\\\\CurrentControlSet\\\\Control\\\\Video\\\\{xxxxxxxxxxxx}\\\\0001',\r\n     'DeviceName': '\\\\\\\\.\\\\DISPLAY2',\r\n     'DeviceString': 'NVIDIA GeForce RTX 2060 SUPER',\r\n     'StateFlags': 1,\r\n     'height': 1080,\r\n     'height_mm': 299,\r\n     'is_primary': False,\r\n     'width': 1920,\r\n     'width_mm': 531,\r\n     'x': 1920,\r\n     'y': 0}}\r\npprint(general)\r\n{'height_all_monitors': 2160,\r\n 'max_monitor_height': 1080,\r\n 'max_monitor_width': 1920,\r\n 'min_monitor_height': 1080,\r\n 'min_monitor_width': 1920,\r\n 'width_all_monitors': 3840}\r\n\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Uses ctypes to get the resolution information of all available monitors",
    "version": "0.13",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/getmonitorresolution"
    },
    "split_keywords": [
        "ctypes",
        "monitor",
        "resolution"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d529dd9b0b48368f5a50e7f1f93de0147fdb61f40f85b9a1f6f1f6dfdb9e8341",
                "md5": "f4da86999cc6f701765de2661287e665",
                "sha256": "41d8655521a9b35329ab9593bcf312c76e84e886527f3dc843c0040af6e7dd8a"
            },
            "downloads": -1,
            "filename": "getmonitorresolution-0.13-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f4da86999cc6f701765de2661287e665",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 7411,
            "upload_time": "2023-05-19T10:28:10",
            "upload_time_iso_8601": "2023-05-19T10:28:10.755472Z",
            "url": "https://files.pythonhosted.org/packages/d5/29/dd9b0b48368f5a50e7f1f93de0147fdb61f40f85b9a1f6f1f6dfdb9e8341/getmonitorresolution-0.13-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2766a45d5696245d4c2f741e4a725a1adbb1c5e14e16b383cc630b77611bfd08",
                "md5": "2bc729a63230ef90779bdaafbf7702f8",
                "sha256": "eb556a05bffba5e6aca12288024026a806fe6c71b5baf185e787058aab0834c7"
            },
            "downloads": -1,
            "filename": "getmonitorresolution-0.13.tar.gz",
            "has_sig": false,
            "md5_digest": "2bc729a63230ef90779bdaafbf7702f8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 6074,
            "upload_time": "2023-05-19T10:28:13",
            "upload_time_iso_8601": "2023-05-19T10:28:13.279353Z",
            "url": "https://files.pythonhosted.org/packages/27/66/a45d5696245d4c2f741e4a725a1adbb1c5e14e16b383cc630b77611bfd08/getmonitorresolution-0.13.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-19 10:28:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "getmonitorresolution",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "getmonitorresolution"
}
        
Elapsed time: 1.02585s