Discussion:
[Tkinter-discuss] class_ attribute on ttk widgets
Alejandro Autalan
2013-03-31 06:58:53 UTC
Permalink
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20130331/369e65d8/attachment.html>
Bryan Oakley
2013-03-31 12:41:50 UTC
Permalink
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
Post by Alejandro Autalan
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.
#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>
Alejandro Autalan
2013-04-01 03:19:28 UTC
Permalink
2013/3/31 Bryan Oakley <bryan.oakley at gmail.com>
Post by Bryan Oakley
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
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss at python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
Woow! I Had not considered the bindings.
Now I understand.

Thanks for the reply. :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20130401/ac1af0b2/attachment.html>
Loading...