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

How to run a python app in the background?

P: n/a
I'm a beginning programmer writing a tiny app with a TkInter GUI.
Desired functionality:
When the user enters a time interval, I want the windows to disappear,
and the program to lie dormant until the scheduled time (currently
using sched module), when it would pop up another window and execute a
command.

Current functionality:
When the user clicks through a showinfo() window, root.quit() is
executed. As I understand it, the program will then complete the
commands that come after root.mainloop(), where I have put
schedule.entry(...) and schedule.run().
The problem is that the windows just hang until the schedule event
happens. The schedule is using time.sleep as the delay. And I have no
idea how I'd create a notification popup when the command runs.

Is there any obvious solution to this problem? Or a tricky solution?
Should I put the scheduler before root.mainloop()? Can I still kill
the main window if I do that?
I want the app to be totally silent during the interim period.

Thanks for your help
Kevin
Nov 21 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Nov 20, 6:13*pm, kevint...@gmail.com wrote:
I'm a beginning programmer writing a tiny app with a TkInter GUI.
Desired functionality:
When the user enters a time interval, I want the windows to disappear,
and the program to lie dormant until the scheduled time (currently
using sched module), when it would pop up another window and execute a
command.

Current functionality:
When the user clicks through a showinfo() window, root.quit() is
executed. As I understand it, the program will then complete the
commands that come after root.mainloop(), where I have put
schedule.entry(...) and schedule.run().
The problem is that the windows just hang until the schedule event
happens. The schedule is using time.sleep as the delay. And I have no
idea how I'd create a notification popup when the command runs.

Is there any obvious solution to this problem? Or a tricky solution?
Should I put the scheduler before root.mainloop()? Can I still kill
the main window if I do that?
I want the app to be totally silent during the interim period.

Thanks for your help
Kevin
Just guessing. Try 'delete root' after 'root.mainloop()', to see if
you can get it to clean up its resources. Otherwise, subprocesses
might be what you want.
Nov 21 '08 #2

P: n/a
Aaron Brady wrote:
On Nov 20, 6:13 pm, kevint...@gmail.com wrote:
>I'm a beginning programmer writing a tiny app with a TkInter GUI.
Desired functionality:
When the user enters a time interval, I want the windows to disappear,
and the program to lie dormant until the scheduled time (currently
using sched module), when it would pop up another window and execute a
command.

Current functionality:
When the user clicks through a showinfo() window, root.quit() is
executed. As I understand it, the program will then complete the
commands that come after root.mainloop(), where I have put
schedule.entry(...) and schedule.run().
The problem is that the windows just hang until the schedule event
happens. The schedule is using time.sleep as the delay. And I have no
idea how I'd create a notification popup when the command runs.

Is there any obvious solution to this problem? Or a tricky solution?
Should I put the scheduler before root.mainloop()? Can I still kill
the main window if I do that?
I want the app to be totally silent during the interim period.

Thanks for your help
Kevin

Just guessing. Try 'delete root' after 'root.mainloop()', to see if
you can get it to clean up its resources. Otherwise, subprocesses
might be what you want.
That would be

del root

However it's somewhat unusual (though not unheard of) to call a window's
mainloop method. A more usual structure calls mainloop() as a function.

If your window isn't disappearing after its mainloop() method
terminates, try calling its destroy() method. That ought to get rid of
it! i.e.

root.destroy()

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

Nov 21 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.