0

How to pause while loop without using sleep function?

Do you guys know how to pause a loop and then when I press a key the loop continues? Is it even possible when using python?

23rd Feb 2021, 7:02 PM
Lugli
Lugli - avatar
3 ответов
0
Hi! If you put an input() inside a while True: statement, it wait for you to put an input. And it start when you hit ’Enter’ So that depeneds what you mean... A code link to your code maybe is a start... Regatds / Per B 🙂
23rd Feb 2021, 7:13 PM
Per Bratthammar
Per Bratthammar - avatar
0
Here's the code Per Bratthammar: import win32api import pyautogui import win32con while True:    get = win32api.GetKeyState(win32con.VK_RBUTTON)    if get < 1:        pyautogui.rightClick()    if win32api.GetKeyState(win32con.VK_XBUTTON1):         #some code here to stop it    if win32api.GetKeyState(win32con.VK_XBUTTON2):        continue
23rd Feb 2021, 7:17 PM
Lugli
Lugli - avatar
0
Mayby some inspiration or ideas from this site: https://www.python-course.eu/tkinter_events_binds.php
23rd Feb 2021, 7:24 PM
Per Bratthammar
Per Bratthammar - avatar