Python Forum
Can I Control loop with Keyboad key (start/stop)
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can I Control loop with Keyboad key (start/stop)
#3
Thank you for your helping. I could solve my probem myself Shy as following these steps.
import mscvrt
while True:
key=mscvrt.getch().decode('utf-8)
if key=='1'
print('System is active.')
elif key=='0'
print('System is inactive.')
Reply


Messages In This Thread
RE: Can I Control loop with Keyboad key (start/stop) - by Lyperion - Jul-28-2018, 10:19 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Button to stop while loop from another script Absolutewind 5 923 Sep-25-2023, 11:20 PM
Last Post: deanhystad
  ''.join and start:stop:step notation for lists ringgeest11 2 2,448 Jun-24-2023, 06:09 AM
Last Post: ferdnyc
  get out of while loop and stop repeat Frankduc 11 3,013 Apr-26-2022, 10:09 PM
Last Post: deanhystad
  tkinter control break a while loop samtal 0 2,409 Apr-29-2021, 08:26 AM
Last Post: samtal
  Start loop from different points TheHolyPyGrenade 3 2,087 Apr-11-2021, 07:57 PM
Last Post: TheHolyPyGrenade
  Stop/continue While loop block Moris526 68 25,764 Mar-28-2021, 09:21 PM
Last Post: Larz60+
  while loop will not stop looping TheTechRobo 5 3,750 Apr-20-2020, 01:47 PM
Last Post: TheTechRobo
  Use Python to start/stop a server service via a webform? oakleaf2001 0 1,763 Apr-04-2020, 06:14 AM
Last Post: oakleaf2001
  start and stop omxlayer playback dezmob 2 4,781 Jan-27-2020, 09:43 AM
Last Post: dezmob
  how to stop and start a script for 30 seconds laspaul 9 7,689 Jan-16-2020, 02:13 PM
Last Post: laspaul

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020