TKinter IntVar() documentation

Jason McDermott mcdermoj at ohsu.edu
Tue Aug 29 14:40:16 EDT 2000


>From: "Benjamin" <benjamin.sauthier at worldonline.fr>
> How does IntVar() works? It is not documented, so I tried to use it by
> myself but it doesn't work well.

I'd look at the source for tkinter.py.

> I've defined one for a checkbutton.
> I want to connect thet value of IntVar() to a callback using trace
>
> v = IntVar()
> v.trace("rw",callback)
>
> def callback(event):
>     do things
>
...

I can't tell you how to solve your specific IntVar problem but what I found
was that explicitly defining a parent widget when creating the IntVar() made
things work. For example, if your app has a variable self.master for the
enclosing window widget, use the call

v = IntVar(self.master)

to create the variable- tkinter looks like it should handle IntVar with no
args just fine, but in my experience weird things happen when I don't
declare a parent. This might solve yer callback-hookup problem. Hope this
helps.

-jason

                               Jason McDermott
                                Phone:494-8098
                                FAX  :494-6862
                                email: mcdermoj at ohsu.edu
                 OHSU, Dept. Microbiology and Immunology, L220
                  _________________________________________
                      __                             __
                   __/  \__          # #          __/  \__
                  /  \__/  \      # # > # #      /  \__/  \
                  \__/  \__/     # < # # < #     \__/  \__/
                  /  \__/  \      # # O # #      /  \__/  \
                  \__/  \__/     # > # # > #     \__/  \__/
                     \__/         # # < # #         \__/
                                     # #
                 _________________________________________
                        URL:http://www.jasonya.com/




More information about the Python-list mailing list