- 1

How create counter

how create couter if click go he is count from 0 inc by 1 when i click stop

6th Mar 2017, 11:08 AM
abdenour babouche
abdenour babouche - avatar
5 Answers
+ 13
#alright fine, since I understand what you're asking, I'll forgive your English. this code is just a example though. it's console only, and the key detection for stop ruins the whole point of the program import time count=0 start=False def start(): global count, start inp=input("say start to begin counting") if inp=="start": start=True count=0 def stop(): global stop inp=input("say stop to stop counting") if inp=="stop": start=False while 1==1: #main if start==False: stop() while start==True: print(count) time.sleep(1) count+=1 stop() #this is REALLY ineffective. there is a better way but I can't remember right now and I'm tired. something called getch I think. you could also use tkinter or pyhook
6th Mar 2017, 12:30 PM
Ahri Fox
Ahri Fox - avatar
+ 12
d=input() if d == "go": count=0 c=input() if c == "stop": count=1 #lel you word your question weirdly so this is what you get
6th Mar 2017, 11:36 AM
Ahri Fox
Ahri Fox - avatar
+ 6
Did you expect Python code? If it is, using 'button" is only possible with GUI API... but there's a lot, and you need at least specify which, if you guess have appropriate answer ^^ If not, you maybe expect web client code ( html/css/js )... But I don't want answer to something I'm not sure: I will take time for that, and probably you will say that's not what you are waiting :P Please: be accurate in your questions!
6th Mar 2017, 2:42 PM
visph
visph - avatar
0
code to start or restart an account and stop counting when you click the stop button
6th Mar 2017, 12:02 PM
abdenour babouche
abdenour babouche - avatar
0
thanks man
6th Mar 2017, 1:07 PM
abdenour babouche
abdenour babouche - avatar