Skip to Main Content
Learning Perl/Tk
book

Learning Perl/Tk

by Nancy Walsh
January 1999
Beginner content levelBeginner
373 pages
9h 43m
English
O'Reilly Media, Inc.
Content preview from Learning Perl/Tk

Chapter 13. Toplevel Widgets

Any Perl/Tk application includes at least one toplevel widget. When you call the new method from the MainWindow class, you are creating a toplevel widget without even knowing it. You can create other toplevel widgets to be used in your application in addition to the MainWindow toplevel widget. The MainWindow is special because it automatically displays when you call MainLoop(). Other toplevel widgets in your program must be explicitly displayed somewhere in the code.

Here are some examples of how you can use toplevel widgets:

  • Display informational text with a Close button. [1]

    [1] Look at Tk::Dialog. It is designed to do this and uses a toplevel widget.

  • Provide data gathering that is triggered by something the user does (for example, clicking a button).

All toplevel widgets have the same behavior: Each has decoration that is consistent with the system on which your application is run. Each toplevel can contain other widgets and/or multiple groups of widgets (for example, they can be grouped in a frame widget).

The rest of the chapter will cover how to use toplevel widgets and what options allow you to change their behavior.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Perl/Tk

Mastering Perl/Tk

Stephen Lidie, Nancy Walsh

Publisher Resources

ISBN: 1565923146Supplemental ContentCatalog PageErrata