[Tkinter-discuss] Changing the fonts on my Pmw.NoteBook tabs

Michael Lange klappnase at freenet.de
Wed Jul 21 00:45:35 CEST 2004


On Wed, 21 Jul 2004 07:04:58 +1000
Peter Milliken <PeterM at resmed.com.au> wrote:

> The following is under the "Dynamic Components" section of the reference
> page for Pmw.NoteBook:
>  
> "Page and tab components are created dynamically by the add() and insert()
> methods. By default, the pages are of type Tkinter.Frame and are created
> with a component group of Page and the tabs are of type Tkinter.Button and
> are created with a component group of Tab."
>  
> Using this information as a "clue" :-), you can use calls to get the
> components of the NoteBook i.e. assuming your notebook instance was called
> "DisplayPages" and it had tabbed pages called "Entry", "Results" then you
> would have the following
>  
> print self.component("DisplayPages").components()
>  
> ['Entry', 'Entry-tab', 'Results', 'Results-tab', 'hull']
>  
> So the Frame component for the Entry tabbed page is called 'Entry' and the
> Button that contains the name (and font you want to manipulate) is called
> 'Entry-tab'. So to change the font is something like this:
>  
> self.component('DisplayPages').component('Entry-tab').configure(font =
> ('Helvetica', 10, 'bold italic'))
>  
> This is probably more detail than you were asking for but hey, what the
> hell! :-)
>  
> Regards
> Peter
  
Why not just use this one (Pmw library reference):

 tab(pageIndex)

Return the tab component widget of the page pageIndex, where pageIndex may have any of the forms accepted by the index() method. If tabpos is None, return None. 

So I think tab(pageName).configure(font=xyz) should do the job

Michael




More information about the Tkinter-discuss mailing list