1

I am writing a python app using Tkinter for buttons and graphics and having trouble getting a timer working, what I need is a sample app that has three buttons and a label.

[start timer] [stop timer] [quit]

When I press the start button a function allows the label to count up from zero every 5 seconds, the stop button stops the timer and the quit button quits the app.

I need to be able to press stop timer and quit at any time, and the time.sleep(5) function locks everything up so I can't use that.

currently i'm using threading.timer(5,do_count_function) and getting nowhere !

I'm a vb.net programmer, so python is a bit new to me, but hey, i'm trying.

1 Answer 1

2

Check the .after method of your Tk() object. This allows you to use Tk's timer to fire events within the gui's own loop by giving it a length of time and a callback method.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.