By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,898 Members | 1,198 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,898 IT Pros & Developers. It's quick & easy.

I want a program to repeat itself multiple times before stopping, how do i do this?

P: 2
I have this program that an associate will input their ID# then it prints back saying (your associate ID# is XXX) then it will state what time it they clocked in/out--Ex: Your ID# is 101 and you left at 13:45:00
...the program also dumps their ID# and times into a seperate file so it can be logged and reviewed at any time.

My problem is once you run the program one time, it quits..then you must run module over again. How do i just keep it running for multiple hours at a time?

I'm using the python GUI and just clicking F5-key to run module and forget about the "While" function i have in the code i took it out...(Just for more information if needed)
Thank you, Colt
Attached Files
File Type: txt mycodeout.txt (588 Bytes, 490 views)
Feb 20 '11 #1
Share this Question
Share on Google+
3 Replies

Expert 100+
P: 624
If I understand you correctly, use a while() loop in a second program. The second programs executes the first program using subprocess, so after an ID, etc. is entered it will exit the first program, loop back and ask for an ID again. A more straight forward way is to use a function, pass the output file handle to the function, and call the function within a while() loop.
Feb 20 '11 #2

Expert Mod 2.5K+
P: 2,851
Your code is a script that executes and ends. You are importing Tkinter, but not using it. You could write your GUI with Tkinter. The GUI could be designed with buttons and entry fields and could react to events without closing.
Feb 20 '11 #3

P: 2
Thank you very much i believe i got it!
Feb 20 '11 #4

Post your reply

Sign in to post your reply or Sign up for a free account.