In the following code :
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
import Tkinter
import os
import threading
class Fil (threading.Thread):
def __init__ (self):
threading.Thread.__init__ (self)
print "Init Fil"
def f1 (self):
print 'f1'
#app().ecrit(1)
class App(Tkinter.Tk):
def __init__(self,parent):
Tkinter.Tk.__init__(self,parent)
print "Init App"
self.initialize()
ping()
def initialize(self):
self.grid()
self.bouton1L = Tkinter.Label(text="-", bg = "#00ffc0")
self.bouton1L.grid(column=0, row=1)
self.bouton2L = Tkinter.Label(text="-", bg = "#00ffc0")
self.bouton2L.grid(column=1, row=1)
self.x = Tkinter.Label(width=32)
self.x.grid(column=0, row=2)
def ecrit(self, num):
if num == 1:
self.bouton1L.configure(text="0")
elif num == 2:
self.bouton2L.configure(text="1")
def ping():
for x in xrange ( 2 ):
Fil().f1()
app.bouton1L.reconfigure(text="A") # app not recognized
# ------------------
if __name__ == "__main__":
app = App(None)
app.ecrit(2)
app.mainloop()
"app" is not recognized, for example in function "ping" in the above example. I am trying to write a program with several threads and a single window where results of threads are displayed.
Thanks for your help.