Looks great!
Thanks!

John McMonagle-3 wrote:
> 
> 
> Use the winfo_class() method (Example below):
> 
> from Tkinter import *
> r = Tk()
> b = Button(r, text='test')
> b.pack()
> c = Checkbutton(r)
> c.pack()
> e = Entry(r)
> e.pack()
> 
> widgets = [b,c,e]
> 
> def widgetMethod(widget):
>     if widget.winfo_class() == 'Button':
>         print 'A Button widget!'
>     elif widget.winfo_class() == 'Checkbutton':
>         print 'A Checkbutton widget!'
>     elif widget.winfo_class() == 'Entry':
>         print 'An Entry widget!'
> 
> for widget in widgets:
>     widgetMethod(widget)
> 
> r.mainloop()
> 
> 
> 


-----
---------------------------------------------------
"I'd like to share a revelation that I've had during my time here. It came
to me when I tried to classify your species and I realized that you're not
actually mammals."
-- Agent Smith
-- 
View this message in context: 
http://www.nabble.com/Finding-Tkinter-widget-types-tp24291475p24357016.html
Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to