A unique instance of Python GUI program

Georg Altmann george at george-net.de
Tue Sep 16 13:39:03 CEST 2008


akineko schrieb:
> Hello everyone,
> 
> This may not be a Python specific challenge.
> I have a GUI program written in Python + Tkinter.
> It works very well.
> 
> Now, I would like to start it from a shell script.
> As my GUI program includes a server, it should not have more than one
> instance.
> Is there any easy way to check if another instance of the program is
> already running.
> 
> I vaguely remember that Windows programming provides a way to check.

On windows a mutex does the job, see CreateMutex in the windows api.

> A platform independent approach would be nice but a solution for X is
> sufficient for my application.

I'm not familiar with Tkinter - you might want to check if it supports 
mutexes. Though I'm not sure if mutexes are cross-process (system wide) 
on all platforms.

Regards
Georg




More information about the Python-list mailing list