On Mon, Apr 20, 2015 at 2:10 AM, Alan Gauld <alan.ga...@btinternet.com> wrote: > On 20/04/15 04:34, boB Stepp wrote: > >> So, how do I: >> 1) Check for the existence of an already open window from a previous >> running of the script? >> 2) If such a window exists, how do I close it from the new script >> execution? And, then, of course generate a new instance of the >> information window. > > > I would suggest forgetting about windows and think about > the processes that create them. Use the OS tools (via > the os module) to see if the first process is still running. > If so kill the process - which will in turn kill the window.
I started poking around a little in this area in my books, but did not know if this was the way to go or not. I was still hung up on how to identify the correct process... > You can find the process based on its name or based on > its PID which you could store in a file somewhere > (like in /tmp?) I was thinking in these terms from a Tkinter window id perspective, but storing the PID while the original window is known to be open looks like the way to go. Thanks, Alan! I may have more questions on this later as I have not explicitly worked with this via Python. I've only killed processes via the command line before. >> I feel the solution must be in Tkinter's access to the X Window >> system, but nothing in the documentation is *clicking* with me yet. > > > Trying to manipulate GUIs via the windowing system should always > be a last resort, it is very hard to get right. If I am learning nothing else from my exploration of GUI programming, this is becoming ever more evident! -- boB _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor