Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ability to get screen resolution/size #292

Closed
wants to merge 1 commit into from

Conversation

olumidesan
Copy link

@olumidesan olumidesan commented Jul 23, 2020

Hi.

Was looking to add the ability to get the screen size of the current system, as I always have to use another library (pyautogui) to do that. Would be nice if pynput could have a small utility function that does that.

Not sure if the PR follows your folder structure, but I really just wanted to show the basic functionality itself, leaving folder logistics for later. So, I added a screen module and a get_screen_size() function that, essentially, loops through the borders of the screen to get the screen size.

Let me know what you think.

A simple test:

>>> from pynput.screen.utils import get_screen_size
>>> get_screen_size()
(1920, 1080)

@moses-palmer
Copy link
Owner

Thank you for your contribution.

You may want to have a look at #74 which adds this functionally by querying the operating system. Please note that it has not been merged, since I felt the API to be a bit limiting. Given that you have also required this functionality, perhaps it is time to put in the effort to merge it.

Since this PR adds the same capability to the library as another one, I will close this.

@olumidesan
Copy link
Author

Alright, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants