Malcolm
Malcolm

Reputation: 5323

Python/Tkinter: Using the new ttk.Notebook widget (custom font, trapping tab focus/mouseover)

I'm using the new ttk.Notebook widget available in Python 2.7 and Python 3.1.

I'm struggling with the following tasks:

  1. How to change the font associated with notebook tab captions. I want to use a named font object whose size a user controls. (Could a ttk.Style help me here?)

  2. How can I bind to tab specific keyboard focus (<FocusIn>), mouseover events (<Enter>), and rightclicks (<Button-3>). I have a total fail trying to bind to tab specific keyboard focus and mouseover events. I can bind to a <Button-3> rightclick, but I can't figure out how to determine the tab a user clicked on. Using .identify( event.x, event.y ) returns the string 'label' vs. a widget reference.

  3. Is there a way to give tabs an id (the documentation hints at this via tab_id) so we can reference tabs independent of their physical position in an array of tabs?

Thank you, Malcolm

Upvotes: 1

Views: 2298

Answers (1)

Cameron Laird
Cameron Laird

Reputation: 1075

We're actually answering these questions in the Tkinter mailing list; in fact, I have mixed feelings about saying anything in Stackoverflow apart from, "See the mailing list". It's surely fair to note, though, that this answers the question about fonts, and this heads a thread on tab events.

Upvotes: -1

Related Questions