import time
import ctypes
import threading
import msvcrt
# マウスカーソルの移動を実行する関数
def move_mouse(x, y):
ctypes.windll.user32.SetCursorPos(x, y)
# 実行中の表示と終了のためのキーを表示する関数
def show_status():
print("マウスイベント実行中です。終了するには Ctl+Cキーで中断して'Q'キーを押してください。")
# キーボード入力を待機して終了する関数
def wait_for_exit():
while True:
if msvcrt.kbhit() and msvcrt.getwch() == 'q':
break
# メインの処理
thread = threading.Thread(target=wait_for_exit)
thread.start()
while thread.is_alive():
# マウスカーソルの移動先の座標を指定してください
x = 200
y = 200
move_mouse(x, y)
show_status()
time.sleep(1 * 60)
print("プログラムを終了します。")