Hi Adam,

On Wed, 10 Jun 2009 15:19:14 -0500
Adam Kadzban <akadz...@iit.edu> wrote:

(...)
> boxes and entry boxes so you can change the option list.  Here's the
> relevant code:
> 
> ...
> self.tVar = IntVar()
> ...
> self.tempbutton =
> Checkbutton(self.tophalf,variable=self.tVar,text="Calculate
> temperature") ...
> 
> When I try the program with this code, I can check/uncheck the boxes,
> but tVar never change (I printed out their values, they stay 0).  I
> also tried coding in button selection (e.g. self.tempbutton.select
> ()), but tVar never changes.

I cannot reproduce this here, maybe it depends on the OS or the Tk
version in use. Just a guess: have you tried to explicitely define
onvalue=1 and offvalue=0 in the Checkbutton constructor ?

Michael 

> 
> I also tried making some functions, and binding them to the
> checkbutton: self.tempbutton =
> Checkbutton(self.tophalf,variable=self.tVar,text="Calculate
> temperature",command=self.checkTemp)
> ...
> def checkTemp(self):
>     if self.tVar.get() == 1:
>         self.tempbutton.select()
>     else:
>         self.tempbutton.deselect()
> ...
> Having that, though, doesn't let me "check" the button (I'm guessing
> because tVar never gets set to 1, it always goes to deselect).
> 
> Anyone have any ideas why this is happening?  I've been banging my
> head against a wall here, and I rewrote the whole class thinking
> maybe it was something funny with scoping, but as far as I can tell
> everything is ok.  I must be missing something...
> 
> Thanks,
> Adam
> 
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to