A package that creates and manipulates screen overlays based on tkinter.
Project description
Overlay
A package that creates and manipulates screen overlays based on tkinter.
Platforms
- Mac OS
- Linux (not tested)
- Windows (not tested)
Installation
pip install overlay
Usage
A basic overlay is created as such:
from overlay import Window
win = Window()
Window.launch()
The constructor of the Window class takes the following (optional) parameters:
- size: tuple, the dimension (width, height) of the overlay window.
- position: tuple, the position of the overlay (on screen).
- transparent: bool, whether to set the overlay background transparent.
- alpha: float [0, 1], the alpha (transparency) of the overlay.
- draggable: bool, whether the window can be dragged
Note that the parameters mentioned above can be edited any time as attributes of an instance of Window.
In order to edit the content of a overlay, one needs to obtain the root of the overlay, upon which all else shall be build.
import tkinter as tk
from overlay import Window
win = Window()
label = tk.Label(win.root, text="Window_0")
label.pack()
Window.launch()
Multiple overlays can be created just as easily:
import tkinter as tk
from overlay import Window
win_0 = Window()
label_0 = tk.Label(win_0.root, text="Window_0")
label_0.pack()
win_1 = Window()
label_1 = tk.Label(win_1.root, text="Window_1")
label_1.pack()
Window.launch()
The following program covers a brief explaination on other methods of the Window class.
import tkinter as tk
from time import sleep
from overlay import Window
def other_stuff(text):
print(text)
sleep(2)
win_0.hide() # Hides the overlay.
sleep(1)
win_0.show() # Shows the overlay.
sleep(1)
Window.hide_all() # Hides all overlays.
sleep(1)
Window.show_all() # Shows all overlays.
sleep(1)
win_0.destroy() # Kills the overlay.
sleep(1)
Window.destroy_all() # Kills all overlays and ends the mainloop.
'''Creates two windows.'''
win_0 = Window()
label_0 = tk.Label(win_0.root, text="Window_0")
label_0.pack()
win_1 = Window()
label_1 = tk.Label(win_1.root, text="Window_1")
label_1.pack()
Window.after(2000, other_stuff, 'Hello World') # Identical to the after method of tkinter.Tk.
Window.launch()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file overlay-1.1.0.tar.gz
.
File metadata
- Download URL: overlay-1.1.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1ad4b0ff3f25daca32e92d5923a09fb7c5af8ea26d200942f2bfdca6d6a56e4 |
|
MD5 | 8671df66d88b01170556fb1d7fa45e89 |
|
BLAKE2b-256 | 8db177ff041030625ec458214f8b0ddf781a1a757ec9bd94a3b7829a704efec1 |
File details
Details for the file overlay-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: overlay-1.1.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d67ceb5c8706adae9e6a636eace39742f1e4edc3a18b0383b1970156e6dd760c |
|
MD5 | 9a5408bfb9855cc4ffb45d652aa37db1 |
|
BLAKE2b-256 | 5e00369ed47eca373d25303129d1833d7e0ee0b677a19852032be4ff1412791b |