problem with tkinter

max(01)* max2 at fisso.casa
Tue Mar 29 19:29:53 CEST 2005


hello.

the following code:

       1 from Tkinter import *
       2
       3 class MiaApp:
       4   def __init__(self, genitore):
       5     self.mioGenitore = genitore
       6     self.i = IntVar()
       7     self.i.set(42)
       8     self.s = StringVar()
       9     self.s.set("Baobab")
      10     self.lab = {}
      11     self.lab["self.i"] = Label(self.mioGenitore)
      12     self.lab["self.i"].configure(width = 30, relief = RIDGE,
      13       text = "[vuota]")
      14     self.lab["self.i"].pack()
      15     self.lab["self.s"] = Label(self.mioGenitore)
      16     self.lab["self.s"].configure(width = 30, relief = RIDGE,
      17       text = "[vuota]")
      18     self.lab["self.s"].pack()
      19     self.but = Button(self.mioGenitore)
      20     self.but.configure(text = "Vai!", command = self.procedi)
      21     self.but.pack()
      22   def procedi(self):
      23     for var in ("self.i", "self.s"):
      24       self.lab[var].configure(textvariable = var)
      25
      26 radice = Tk()
      27 miaApp = MiaApp(radice)
      28 radice.mainloop()

is intended



More information about the Python-list mailing list