The type of a tkinter StringVars and IntVars?

Steven Bethard steven.bethard at gmail.com
Thu Oct 21 19:07:13 EDT 2004


Bob Greschke <bob <at> passcal.nmt.edu> writes:

> How would I do the same thing if
> 
> a = IntVar()
> a.set(6)
> 
> and then do
> 
> if type(a) == IntVar:
>     Root.bell()

I don't do much GUI programming, but I believe you're looking for 
the 'isinstance' function:

>>> class IntVar(object):
...     pass
...
>>> a = IntVar()
>>> isinstance(a, IntVar)
True


Steve




More information about the Python-list mailing list