-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5846516
commit d5d9864
Showing
15 changed files
with
313 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
class Box(tuple): | ||
def __init__(self, x: int, y: int, width: int, height: int): | ||
"""This is just here for autocompletion""" | ||
pass | ||
|
||
def __new__(self, x: int, y: int, width: int, height: int): | ||
return tuple.__new__(Box, (x, y, width, height)) | ||
|
||
@property | ||
def x(self) -> int: | ||
return self[0] | ||
|
||
@property | ||
def y(self) -> int: | ||
return self[1] | ||
|
||
@property | ||
def width(self) -> int: | ||
return self[2] | ||
|
||
@property | ||
def height(self) -> int: | ||
return self[3] | ||
|
||
def __repr__(self) -> str: | ||
return f'Box(x={self.x}, y={self.y}, width={self.width}, height={self.height})' | ||
|
||
|
||
def main() -> None: | ||
try: | ||
from rich import print | ||
except ImportError: | ||
pass | ||
box = Box(100, 200, 300, 400) | ||
print(box) | ||
print(f"x={box.x}") | ||
print(f"y={box.y}") | ||
print(f"width={box.width}") | ||
print(f"height={box.height}") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
class MouseButtons(object): | ||
""" | ||
https://tronche.com/gui/x/xlib/events/keyboard-pointer/keyboard-pointer.html\n | ||
/usr/include/X11/X.h: 259-263 | ||
""" | ||
LEFT = 1 | ||
RIGHT = 2 | ||
MIDDLE = 3 | ||
FORWARD = 4 | ||
BACKWARD = 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.