hello everybody.

i am a a bit of a newbie in python/tkinter,and i am experimenting a bit with widgets like checkbuttons.

in python, you can create a checkbutton instance like this:

....
self.tergicristalli = IntVar()
self.b1 = Checkbutton(self.pulsanti_spunta)
self.b1.configure(
  text = "Tergicristalli a posto",
  variable = self.tergicristalli  ### (1)
  )
self.b1.pack()
....

where you bind the widget to a variable 'self.tergicristalli', which will be updated as the user checks/unchecks the checkbutton.

maybe i interpret the question incorrectly, but the syntax (1) seems like assigning the *value* of 'self.tergicristalli' to the variable
variable, while it is more like an aliasing instead...


my question is: how can i embed the above code inside a function body, such that the function accepts as a parameter the variable to bind the option 'variable' to (not the value, mind you!)? like this:

def acceptName(name):
  ....
  self.tergicristalli = IntVar()
  self.b1 = Checkbutton(self.pulsanti_spunta)
  self.b1.configure(
    text = "Tergicristalli a posto",
    variable = name ### <<<--- THIS IS NOT WHAT I MEAN, OF COURSE!
    )
  self.b1.pack()
  ....

bye bye

macs
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to