Reputation: 819
I am trying to update a frame using a process, but I am unable to do so. If I don’t use a process, the frame is updating with the child elements, but not when using multiprocess.
This is what I've tried (the code is part of a class):
def zx(self, q):
print('asdadsas')
lbl = Label(self.myframe, text="assagj")
lbl.pack(ipady=2, padx=10, pady=5, anchor=NW)
try:
p = multiprocessing.Process(target=self.zx, args=('a', ))
p.daemon=True
p.start()
sleep(2)
p.terminate()
except KeyboardInterrupt:
p.terminate()
except:
p.terminate()
Upvotes: 0
Views: 218
Reputation: 386342
Tkinter widgets can't span processes. All access to Tkinter widgets must be from within the same process.
This is because the widgets exist in an embedded Tcl interpreter, and that Tcl interpreter can't be shared across processes.
Upvotes: 3