Forum: Poser Python Scripting


Subject: running two scripts (with tkinter GUI) at the same time

tromnek opened this issue on Dec 04, 2004 ยท 10 posts


tromnek posted Sat, 04 December 2004 at 7:29 PM

When I have two scripts running each with a GUI (tkinter).

If I close one, the other crashes. I've been using (somewhat blindly) the application setup I generally see in Okham's stuff see big snippet below.

Is there something special I should do to fix this?
tia,
ken

...snip...
class App:
def init(self, master, textMessage):

self.master = master
master.title("TromNek's Library Executor")

self.buttonGo = Button(self.master, text="Load", command=self.handleGo)
self.buttonGo.grid(row=1, column=3)
...snip...

self.master.protocol('WM_DELETE_WINDOW', self.handleCancel)

def check_conn(self):
conn, (remotehost, remoteport) = sock.accept()
...snip...

def handleCancel(self):
self.master.destroy()

def Update(self):
try:
self.check_conn()
except:
pass
if scene: scene.ProcessSomeEvents(1)
root.lift()
root.after(100, self.Update)

Activate the loop

root = Tk()
app = App(root, '')
app.Update()
root.mainloop()

End TK loop.