tags:

views:

137

answers:

1

Hi,

I’ve writen a little python script that just pops up a message box containing the text passed on the command line. I want to pop it up only when the window —resulting from a previous call— is not open.

from Tkinter import *
import tkMessageBox

root = Tk()
root.withdraw() 

# TODO not if a window with this title exists
tkMessageBox.showinfo("Key you!", " ".join(sys.argv[1:]))

Any idea how to check that?

Thanks

+1  A: 

I believe you want:

if 'normal' != root.state():
    tkMessageBox.showinfo("Key you!", " ".join(sys.argv[1:]))
I’ve tried this, it doesn’t work, the new window opens anyway.Maybe I wasn’t clear enough: Two python interpreters are running at the same time. I want the second process to exit when the other one is running, i.e. when the window —or any window with that title— is already open.
Tibi