Giter Club home page Giter Club logo

rotate-screen's People

Contributors

danny-burrows avatar pedroelir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

rotate-screen's Issues

TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

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.

Interesting Bug

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.

Monitor layout:
image

GNU/Linux

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

Python 3.12 has been released - Time to test, add to CI, and add to setup.py.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.