473,326 Members | 2,680 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

How to run a python app in the background?

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
2 2997
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Eric Brunel | last post by:
Hi all, I was creating a Tkinter widget in the style of the reversed tabs below Excel worksheets and I stepped in a serious problem: the code I made makes python crash with a seg fault, bus...
14
by: Eduardo Patto Kanegae | last post by:
Hello, I have been programming with Visual Basic and PHP in the last 5 years and some folks had recommended Python a free language.... I had looked for a Python book to start up but found many...
38
by: kbass | last post by:
In different articles that I have read, persons have constantly eluded to the productivity gains of Python. One person stated that Python's productivity gain was 5 to 10 times over Java in some in...
14
by: David MacQuigg | last post by:
I am starting a new thread so we can avoid some of the non-productive argument following my earlier post "What is good about Prothon". At Mr. Hahn's request, I will avoid using the name "Prothon"...
3
by: David MacQuigg | last post by:
I am writing a chapter for teaching OOP in Python. This chapter is intended as a brief introduction to replace the more complete discussion in Learning Python, 2nd ed, pp. 295-390. I need to...
1
by: M.E.Farmer | last post by:
Hello c.l.py!, I have just finished this and decided to share. PySourceColor is a module to convert Python source into colored html. Yes it has been done before, but I like this better:) You can...
7
by: Arun | last post by:
Hi, This is a scripting question, but since I am writing the script in python I am posting this question here: I have a python script that runs a simulator (that was written in c++, so I use...
2
by: praba kar | last post by:
Dear All, I want to know the link between c and python. Some people with C background use Python instead of programming in C.why? regards Prabaha
4
by: Bell, Kevin | last post by:
Great! And now that it's hiding w/ .pyw, how would I kill it if I want? Just log off, or is there a better way? Kevin
3
by: JenAsh | last post by:
In my python file I have several css calls--they all works except for the background image CSS call. ..mystyle { background-image: url(http://www.mysite.com/images/background.gif); } When I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.