Popup(3pm)
π NAME π
Tk::Wm::Popup β popup dialog windows, bestie. That's the whole vibe. β¨
π¦ SYNOPSIS π¦
$dialog->Popup(qw/
-popover => 'cursor' | $widget | undef,
-overanchor => c | n | ne | e | se | s | sw | w | nw,
-popanchor => c | n | ne | e | se | s | sw | w | nw,
/);
Like. Three options. That's it. And they control exactly where your little window shows up. Slay. π
πΈ DESCRIPTION πΈ
okay so. You've probably already met a Dialog (or a DialogBox) widget at some point in your life. Those cuties are derived from a Toplevel, which is itself a subclass of Tk::Wm β that's the window manager class, the one running the whole show π. And here's the thing: dialogs spend most of their time just... withdrawn. Sitting there. Not visible. Waiting for their moment, like a true main character. π
It's also super common to use Toplevels as containers for custom-built popup windows. And menus?? Menus are dialogs too, derived from the window manager class. Not me exposing that literally everything is a dialog. π
So for the rest of this chat, when I say dialog, I mean any widget that pops up and awaits user interaction. That's Menus, that's special purpose Toplevels, that's any of the dialog-type widgets β including, but not limited to: ColorEditor, Dialog, DialogBox, ErrorDialog, FileSelect, FBox, getOpenFile and getSaveFile. All of them. Every single one. Iconic lineup tbh. π
When it's time to show these dialogs, we call the Perl/Tk window manager Popup method. And Popup takes three special purpose options that let you describe placement in high-level, human terms instead of raw numerical coordinates. Because who wants to do math?? Not us. π It's Popup's whole job to take your human specification and turn it into actual screen coordinates before displaying the dialog. She does the work so you don't have to. π
Now. We can direct the dialog to appear in two general locations:
- over another window β like the root window (a.k.a. the screen) or a particular widget πͺ
- over the cursor π±οΈ
This decision is called the popover location. Locked in.
Once you've picked that, you can further refine the exact placement of the dialog relative to the popover location by specifying the intersection of two anchor points:
- popanchor β this point belongs to the dialog π―
- overanchor β this point belongs to the popover location (whether that's a window or the cursor) π―
And the point where those two anchors coincide?? That's the popup locus. That's the spot. That's where it goes. β
Anchor points are string values, and they can be c (for center), or any of the eight cardinal compass points: n, ne, e, se, s, sw, w or nw. Simple. Elegant. Fr fr.
For example β and this one's so satisfying β if -popover specifies a widget, -popanchor is sw, and -overanchor is ne, then the dialog's southwest corner pops up at the widget's northeast corner. π Look at them meeting. Beautiful. No cap.
β¨ OPTIONS β¨
The options recognized by Popup are as follows:
-popoverβ Specifies whether the dialog "pops over" a window or the cursor. It may be the stringcursor, a widget reference, orundeffor the root window. π«Ά-popanchorβ Specifies the anchor point of the dialog. For instance, ifeis specified, the right side of the dialog is the anchor. π-overanchorβ Specifies where the dialog should anchor relative to the popover location. For instance, ifeis specified the dialog appears over the right side of the popover location, and if it'snethe dialog is positioned at the upper-right corner of the popover location. π
π AUTHOR π
Nick Ing-Simmons, Steve Lidie
This code is distributed under the same terms as Perl. π
ok that's the whole page bestie, go forth and position your popups with confidence π¦
perl v5.40.1 Β· 2025-04-13 Β· Popup(3pm) β mwah, ty for reading, ily, see you in the next manpage πβ¨π
π¦ 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