NoteBook(3pm)

πŸ‘‘ Tk::NoteBook β€” the notebook metaphor page πŸ’–

okay bestie, welcome to Tk::NoteBook(3pm) β€” a User Contributed Perl Documentation page, and honestly? it's giving tabs. It's giving limited space, infinite pages. Let's get into it ✨


🌸 NAME 🌸

Tk::NoteBook β€” display several windows in limited space with notebook metaphor. πŸ¦‹


✨ SYNOPSIS ✨

use Tk::NoteBook;
...
$w = $frame->NoteBook();
$page1 = $w->add("page1", options);
$page2 = $w->add("page2", options);
...
$page2 = $w->add("page2", options);

like… yes, $page2 shows up twice. that's the original, we don't gatekeep, we don't edit πŸ’…


πŸŽ€ DESCRIPTION πŸŽ€

The NoteBook widget is the notebook metaphor, and it exists so you can show several windows in a limited space. Iconic behavior, honestly. The notebook is divided into a stack of pages, and only one of them is visible at any given time. πŸ“š

Want a different page? You pick the visual "tabs" at the top of the widget. Also the <Tab> key traverses the pages, so keyboard girlies are covered. And if -underline is in play, Alt- bindings work too. 🫢

The widget takes all the options that a Frame does. On top of that, it supports these:

  • -dynamicgeometry β€” if you set it to false (the default, and the recommended vibe), the NoteBook's size matches the size of the largest page. If you set it otherwise, the size matches the size of the current page instead β€” which means the NoteBook resizes itself whenever you flip between pages of different sizes. 😭
  • -ipadx β€” how much internal horizontal padding wraps around the pages.
  • -ipady β€” how much internal vertical padding wraps around the pages.
  • -backpagecolor β€” the background color of the tabs and the back page. 🎨
  • -disabledforeground β€” XXX πŸ™ˆ (yes. that's genuinely all it says. no cap.)
  • -focuscolor β€” the color of the focus border around the tabs.
  • -font β€” the font of the tab labels. ✍️
  • -inactivebackground β€” XXX πŸ™ˆ (same energy. that's the whole thing.)
  • -tabpadx β€” horizontal padding around the tab label.
  • -tabpady β€” vertical padding around the tab label.

πŸ’… METHODS πŸ’…

These are the methods you can use with a NoteBook object, in addition to the standard methods. slay.

add(pageName, options)

Adds a page named pageName to the notebook, and returns an object of type Frame. The options it recognizes are:

  • -anchor β€” how the info in a tab gets displayed. Gotta be one of n, ne, e, se, s, sw, w, nw or center.
  • -bitmap β€” a bitmap to display on this page's tab. It only shows up if neither -label nor -image is specified.
  • -image β€” an image to display on this page's tab. It only shows up if -label is not specified.
  • -label β€” the text string to display on this page's tab.
  • -justify β€” when there are multiple lines of text in a tab, this decides the justification of those lines.
  • -createcmd β€” a callback called the first time the page is shown on screen. The whole point: you can delay building a page's contents until you actually need them. Which is huge when you've got a NoteBook with a large number of pages β€” with -createcmd you don't force the user to sit there waiting while every page gets constructed before the first one even shows. main character energy for real πŸ”₯
  • -raisecmd β€” a callback called whenever this page is raised by the user.
  • -state β€” whether this page can be raised by the user. Must be either normal or disabled.
  • -underline β€” the integer index of a character to underline in the tab. The default bindings use this to implement keyboard traversal for menu buttons and menu entries. 0 is the first character of the text displayed on the widget, 1 is the next one, and so on.
  • -wraplength β€” the maximum line length of the label string on this tab. If the label string's line length goes past it, the text wraps onto the next line so that no line is longer than the length you gave. The value can be in any of the standard forms for screen distances. If the value is less than or equal to 0, no wrapping happens at all: lines break only at newline characters in the text. 🌈

delete(pageName)

Deletes the page identified by pageName. bye bestie πŸ‘‹

pagecget(pageName, -option)

Returns the current value of the configuration option given by -option, in the page given by pageName. Option can be any of the values accepted in the add method.

pageconfigure(pageName, options)

Like configure, but for the page indicated by pageName. Options can be any of the options accepted by the add method.

pages

Returns a list of the names of all currently defined pages β€” i.e. the ones you made with the add method.

page_widget(pageName)

Returns the page with name pageName.

raise(pageName)

Raises the page identified by pageName. ⬆️

raised()

Returns the name of the currently raised page.

geometryinfo

Returns the dimensions of the tab area. πŸ“

identify(x,y)

Identifies the tab's page name under the specified coordinates. If there's no tab there, it returns an empty string.

info("pages")

Returns a list of all pages.

info("focus")

Returns the page name of the tab that currently has focus. πŸ‘€

info("focusnext")

Returns the page name of the tab that would get the next focus.

info("focusprev")

Returns the page name of the tab that had the previous focus.

info("active")

Returns the page name of the active tab. ⭐


πŸ’€ BUGS πŸ’€

The options -width and -height do not work. that's it. that's the bug. tragic, but true. 😭


🫢 AUTHORS 🫢

Rajappa Iyer <rsi@earthling.net> and Nick Ing-Simmons <nick@ni-s.u-net.com> πŸ’œ

This code and documentation was derived from NoteBook.tcl in Tix4.0, written by Ioi Lam. It may be distributed under the same conditions as Perl itself.


and that's the whole page, bestie β€” this was perl v5.40.1, dated 2025-04-13, filed under NoteBook(3pm). go build something cute with tabs in it πŸ’–βœ¨

πŸ“¦ where this page comes from