danny-burrows / rotate-screen Goto Github PK
View Code? Open in Web Editor NEWA small Python package for rotating the screen.
Home Page: https://pypi.org/project/rotate-screen/
License: MIT License
A small Python package for rotating the screen.
Home Page: https://pypi.org/project/rotate-screen/
License: MIT License
When importing the module i get the following error message with Python 3.9.13 :
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "C:\Users\xxxx\AppData\Roaming\Python\Python39\site-packages\rotatescreen\__init__.py", line 1, in <module>
from .display import *
File "C:\Users\xxxx\AppData\Roaming\Python\Python39\site-packages\rotatescreen\display.py", line 77, in <module>
def get_primary_display() -> Display | None:
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
python-BaseException
Process finished with exit code 1
The solution is to change the
def get_primary_display() -> Display | None:
to
def get_primary_display() -> "Display | None":
in the source code of display.py
I don't know if somebody else had this issue as well. It can be just a problem with this specific Python version
After changing it i could import the module and run the test code without any error.
I hope this helps.
EDIT -Looking through the source code and testing I can see this is a bug with win32api and not this.
Running this code:
for i in rotatescreen.get_displays():
print(i.info)
for i in rotatescreen.get_displays():
print(i.info)
Will Output:
{'Monitor': (0, 0, 1280, 720), 'Work': (0, 0, 1280, 688), 'Flags': 1, 'Device': '\\\\.\\DISPLAY1'}
{'Monitor': (460, 1080, 1460, 1584), 'Work': (460, 1080, 1460, 1584), 'Flags': 0, 'Device': '\\\\.\\DISPLAY2'}
{'Monitor': (0, -1080, 1920, 0), 'Work': (0, -1080, 1920, 0), 'Flags': 0, 'Device': '\\\\.\\DISPLAY3'}
{'Monitor': (-1920, -1088, 0, -8), 'Work': (-1920, -1088, 0, -8), 'Flags': 0, 'Device': '\\\\.\\DISPLAY9'}
Noticeably the primary display, Display 1, is a 1920 by 1080 screen, but here this detects it as a 1280 by 720 display. I double checked and the screen is set to 1920 by 1080. I'm not sure why this is wrong. What is interesting is that Display 2 which is beneath Display 1, begins at a y value of 1080 which is what it should be as it is beneath Display 1. This implies that display 1 is 1920 by 1080 even though this code believes otherwise.
It would be helpful to have some contribution guidelines present in the README or elsewhere.
Can I become project creator, from adding Mac-os version of screen rotation?
When executing a Python script on my Linux machine, the interpreter produces an error.
Abbreviated version of the error:
Traceback (most recent call last):
line 1 in import rotatescreen
line 1 in import winapi32
ModuleNotFoundError: No module named 'win32api'
After some online research, I could not find an easy fix and most results are for Windows systems.
Python 3.12 has been released - Time to test, add to CI, and add to setup.py.
If you have any documentation I can read about it, please let me know or you have any idea.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.