[Tkinter-discuss] Finding variable associated with checkbutton

Cameron Laird Cameron at phaseit.net
Wed Jul 8 23:05:50 CEST 2009


On Wed, Jul 08, 2009 at 01:37:52PM -0700, VladPotrosky wrote:
			.
			.
			.
> How do you find the variable which a checkbutton is linked to?
> example:
> 
> 
> v = IntVar()
> c = Checkbutton(master, text='Foo', variable=v)
> 
> how do you then find out (with code) that v is linked to c?
			.
			.
			.
  if v._name == c.cget("variable").string:
    print "Ah-ha!  They *do* match."

Maybe there is a better way.  That's as far as I've thought about it.



More information about the Tkinter-discuss mailing list