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 ofn,ne,e,se,s,sw,w,nworcenter.-bitmapβ a bitmap to display on this page's tab. It only shows up if neither-labelnor-imageis specified.-imageβ an image to display on this page's tab. It only shows up if-labelis 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-createcmdyou 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 eithernormalordisabled.-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.0is the first character of the text displayed on the widget,1is 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
- debian trixie: perl-tk 1:804.036+dfsg1-5
- ubuntu questing: perl-tk 1:804.036+dfsg1-5
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms