Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Creating themed/style widget question

10 views
Skip to first unread message

Adrian Davis

unread,
Mar 26, 2009, 7:44:45 AM3/26/09
to
I'd like to create a themed/style widget, looking exactly like the ttk
combobox, which pops-up a frame/toplevel instead of a listbox.

Is it possible to script this?

If so, are there and examples which illustrate this?

Many Thanks,
=Adrian=

Alexandre Ferrieux

unread,
Mar 26, 2009, 7:55:12 AM3/26/09
to

Something which is always possible for widget where only the initial
appearance counts, is to bind <ButtonPress-1> with code that ends with
"break".
This way, the default binding is disabled and nothing pops up. You can
post your toplevel/frame at that spot, and set a local grab to detect
clicks outside and unpost it (just like the combobox does internally).

-Alex

adr...@satisoft.com

unread,
Mar 26, 2009, 9:26:07 AM3/26/09
to
> Something which is always possible for widget where only the
initial
> appearance counts, is to bind <ButtonPress-1> with code that ends with
> "break".
> This way, the default binding is disabled and nothing pops up. You can
> post your toplevel/frame at that spot, and set a local grab to detect
> clicks outside and unpost it (just like the combobox does internally).

That seems to do exactly what I want!!

Many Thanks,
=Adrian=

Neil Madden

unread,
Mar 26, 2009, 9:34:52 AM3/26/09
to

The Ttk combobox is itself scripted in Tcl -- check the lib/tk8.x/ttk
folder of your Tcl installation for combobox.tcl. You can see the
bindings that need to be overridden at the top. You can also see that
this code already creates a toplevel and frame to hold the listbox and
scrollbar, so you can probably just copy+paste the relevant bits and
then create a new binding class, then ttk::combobox .cb -class MyCombo.

-- Neil

0 new messages