Caution
This project is not mature enough, I do not plan to add update soon so you may need to adapt the overlay to your need
Table of Contents
pip install pyoverlay
git clone https://github.com/majvax/pyoverlay.git
cd pyoverlay
python -m build
cd dist
pip install pyoverlay.whl
from pyoverlay import Overlay, Point, Rect, RGBA, Color
import win32con
# create the function that will be ran every frames
def on_tick(overlay: Overlay) -> None:
# https://learn.microsoft.com/fr-fr/windows/win32/inputdev/virtual-key-codes
if overlay.get_input(win32con.VK_ESCAPE):
# stops our overlay
overlay.stop()
# only draw if the target is the foreground window
if overlay.target.is_valid:
overlay.draw_test(overlay.target.rect)
if __name == "__main__":
# create our overlay object
overlay = Overlay("Calculator")
overlay.on_tick = on_tick
# create the overlay
overlay.create()
# infinite loop
overlay.run()
from pyoverlay import Overlay, Point, Rect, RGBA, Color
import win32con
class OnTick:
def __init__(self):
self.fov_radius = 50
# create the method that will be ran every frames
def __call__(self, overlay: Overlay):
# https://learn.microsoft.com/fr-fr/windows/win32/inputdev/virtual-key-codes
if overlay.get_input(win32con.VK_ESCAPE):
# stops our overlay
overlay.stop()
# increase the fov on PAGE_UP
if overlay.get_input(win32con.VK_PRIOR):
self.fov_radius += 1
# decrease the fov on PAGE_DOWN
if overlay.get_input(win32con.VK_NEXT):
self.fov_radius -= 1
# only draw if the target is the foreground window
if overlay.target.is_valid:
# draw an empty circle
overlay.draw_empty_circle(overlay.target.rect.center, self.fov_radius, Color.WHITE)
if __name == "__main__":
# create our overlay object
overlay = Overlay("Calculator")
overlay.on_tick = on_tick
# create the overlay
overlay.create()
# infinite loop
overlay.run()