- 1
How create counter
how create couter if click go he is count from 0 inc by 1 when i click stop
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
+ 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
+ 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!
0
code to start or restart an account and stop counting when you click the stop button
0
thanks man