import time from dsbox import DSBox def countdown(seconds: int = 5) -> None: print("Move the cursor to a safe blank area.") print("The DSBox demo will move and click the mouse soon.") for left in range(seconds, 0, -1): print(f"Starting in {left}...") time.sleep(1) def main() -> None: print("Available DSBox devices:") for device in DSBox.list_devices(): print(f" {device}") box = DSBox.connect() try: print("Connected.") countdown() print("Move in a small square.") for dx, dy in ((80, 0), (0, 80), (-80, 0), (0, -80)): box.move(dx, dy) time.sleep(0.25) print("Left / right / middle click.") box.click("left", 30) time.sleep(0.25) box.click("right", 30) time.sleep(0.25) box.click("middle", 30) time.sleep(0.25) print("Wheel up / down.") box.wheel(3) time.sleep(0.25) box.wheel(-3) time.sleep(0.25) print("X1 / X2 side buttons.") box.click("x1", 30) time.sleep(0.25) box.click("x2", 30) print("Done.") finally: box.stop() box.close() print("Closed.") if __name__ == "__main__": main()