[Tkinter-discuss] class_ attribute on ttk widgets

Bryan Oakley bryan.oakley at gmail.com
Sun Mar 31 14:41:50 CEST 2013


It is expected behavior. The built-in key and mouse bindings are bound to the class, so if you change the class of a widget it will no longer have these bindings.

Changing the class is mostly useful if you want to create a completely different set of bindings for a widget. 

--bryan


On Mar 31, 2013, at 1:58 AM, Alejandro Autalan <alejandroautalan at gmail.com> wrote:

> Hello all.
> 
> I'm reading the tkinter reference at http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/index.html.
> 
> It says that the 'class_' attribute is available for ttk widgets.  But when is set, some widgets become  unresponsive.
> 
> Example:
> 
> #uname -a   Linux vostro1 3.2.0-4-amd64 #1 SMP Debian 3.2.39-2 x86_64 GNU/Linux
> # Python 3.2.3
> #tkinter.TkVersion 8.5
> 
> import tkinter as tk
> from tkinter import ttk
> 
> f = ttk.Frame()
> f.grid()
> entry = ttk.Entry(f, class_='CustomEntry')
> entry.grid()
> btn = ttk.Button(f, class_='CustomButton', text='Button')
> btn.grid()
> f.mainloop()
> 
> When I run the example, I can't enter text on entry widget or click a button.
> Is this the expected behaviour? Anyone know how this attribute should be used for ttk widgets ?
> 
> Thanks.
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20130331/88e1780f/attachment.html>


More information about the Tkinter-discuss mailing list