[Tkinter-discuss] ttk.Notebook - how to bind to tab events (tab caption has focus or mouseover)

Michael Lange klappnase at web.de
Wed Dec 15 22:00:41 CET 2010


Hi,

Thus spoketh python at bdurham.com 
unto us on Wed, 15 Dec 2010 14:48:18 -0500:

(...)
> 
> Re: Detect when a tab caption has keyboard focus (<FocusIn> or similar).
> 
> The <<NotebookTabChanged>> does not correspond to the tab caption
> gaining keyboard focus.
> 
> And the notebook widget generates a single <FocusIn> event when it gets
> focus.
> 
> Is there a way to drill-down to the Tk label controls in the captions
> and bind to their <FocusIn> events? Or is there a way to expose the tabs
> as actual widgets whose events can be bound to?

I don't think this is possible, it looks like the notebook widget itself
is one window that catches the <Tab> event and decides what to do - draw
the focus indicator onto the next tab or pass the focus to another window.

But, a far as I see, at least here with IceWm any time a tab receives the
keyboard focus it will be selected as well, so maybe you can play around
with the select mechanism, depending on what exactly you want to achieve.

Regards

Michael


.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

Each kiss is as the first.
		-- Miramanee, Kirk's wife, "The Paradise Syndrome",
		   stardate 4842.6


More information about the Tkinter-discuss mailing list