import Tkinter,multiprocessing
class cambiar(object):
def __init__(self,master,estado=False):
self.master = master
if estado == False:
self.run()
def run(self):
self.master['text'] = 'que tal'
class body(object):
def __init__(self,win):
self.win = win
lista = ['label','botones']
cont = len(lista)
for i in range(cont):
eval('self.'+str(lista[i]+'()'))
def label(self):
self.label_1 = Tkinter.Label(self.win,text='hola')
self.label_1.grid(row=0,column=0)
def botones(self):
self.boton_1 = Tkinter.Button(self.win,text='cambiar',command=lambda :self.win.proceso(self.label_1))
self.boton_1.grid(row=1,column=0)
class main(Tkinter.Tk):
def __init__(self):
Tkinter.Tk.__init__(self)
self.geometry('500x500')
self.b = body(self)
def proceso(self,wid):
self.p = multiprocessing.Process(target=cambiar,args=(wid,))
self.p.start()
root = main()
root.mainloop()
I have this code, which oddly makes no sense what I want is to learn the main process can change properties, such as a label in this case, does anyone know how can I do that?