Platforms Supported
Windows is currently the only platform supported.
Installation
Clone the repo, download as a zip file, or use the following command...
pip install rotate-screen
Documentation
The package comes with some functions to get available displays in the form of <rotatescreen Display> objects. You can then use the <rotatescreen Display> object methods to change the orientation of the display.
Here are a few of the available package functions...
| Function | Returns |
|---|---|
rotatescreen.get_displays() |
Returns a list of <rotatescreen Display> objects for each available display. |
rotatescreen.get_secondary_displays() |
Returns a list of <rotatescreen Display> objects for every display apart from the primary display. |
rotatescreen.get_primary_display() |
Returns a <rotatescreen Display> object for the primary display. |
Here are the available methods (no return value) for a <rotatescreen Display> object...
| Procedure | Arguments | Result |
|---|---|---|
.rotate_to(pos) |
pos (int): Degrees to rotate the screen to. Must be one of 0, 90, 180, 270. | Rotates the screen to desired. |
.set_landscape() |
Rotates the screen to landscape. | |
.set_landscape_flipped() |
Rotates the screen to upside down landscape. | |
.set_portrait() |
Rotates the screen to portrait. | |
.set_portrait_flipped() |
Rotates the screen to upside down portrait. |
Here are the available attributes for a <rotatescreen Display> object...
| Attribute | Returns |
|---|---|
.current_orientation |
Returns (int) the current orientation of the display, will be one of 0, 90, 180, 270. |
.is_primary |
Returns (bool) if the display is the primary monitor. |
.info |
Returns (dict) monitor info. |
.device |
Returns monitor device info. |
.device_description |
Returns (str) visable name for display device. |
Example: 
This is a simple example that implements the 'Ctrl+Alt+Arrow' keyboard shortcut for rotating the display. This is because some graphics cards don't come with this capability by default.
This example requires the keyboard module...
pip install keyboard
Here is the code! It adds hotkeys to rotate the primary display in the desired direction upon the user entering Ctrl, Alt and an arrow key. It then waits until the script is exited.
import rotatescreen
import keyboard
screen = rotatescreen.get_primary_display()
keyboard.add_hotkey('ctrl+alt+up', screen.set_landscape, suppress=True)
keyboard.add_hotkey('ctrl+alt+right', screen.set_portrait_flipped, suppress=True)
keyboard.add_hotkey('ctrl+alt+down', screen.set_landscape_flipped, suppress=True)
keyboard.add_hotkey('ctrl+alt+left', screen.set_portrait, suppress=True)
keyboard.wait()
Example: 
This was a little joke script to show off some more of the modules functionality, due to the way windows rotates the display this is a pretty horrific looking, but entertaining. :)
import rotatescreen
import time
screen = rotatescreen.get_primary_display()
start_pos = screen.current_orientation
for i in range(1, 5):
pos = abs((start_pos - i*90) % 360)
screen.rotate_to(pos)
time.sleep(1.5)
Metadata
Release files for rotate-screen 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rotate-screen-0.1.5.tar.gz | 5.8 kB | Without provenance | Details for rotate-screen-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rotate_screen-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for rotate_screen-0.1.5-py3-none-any.whl |
Total release size: 12.1 kB
Release files / rotate-screen-0.1.5.tar.gz
| Download URL | rotate-screen-0.1.5.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8c1cf9a4d06dc5b4af1e46f62bb48a7bcbaa8fe9a94925c63b54ecafe6cd9cfd
|
|
BLAKE2b-256 checksum How to use checksums |
9302fe45f0bc850729d71624bcee02b250f7bd13d96b7f4515578faa36f1c61a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.4
|
Release files / rotate_screen-0.1.5-py3-none-any.whl
| Download URL | rotate_screen-0.1.5-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
acd477f6e51b18350efd6519ac7edb6ab7bc9070a8ce185d4d04e7aace16369a
|
|
BLAKE2b-256 checksum How to use checksums |
dbcafd462b126c56073702ba7c5b6b11746c9a8da6f3a4d40682b0cb6b25b1d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.4
|
Security for rotate-screen 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.