13.2. Toplevel Methods

The methods available with the toplevel widget are listed and explained in the following sections (it is important to note that all of these methods apply to a MainWindow as well; a MainWindow is just a specialized toplevel widget). You haven't seen many of them before because toplevel is a different sort of widget than the others covered so far in this book. Also keep in mind that a lot of these methods were designed originally for use with a Unix windowing environment, and quite a few of them will state "No effect in Win32 system." Many of these functions serve no useful purpose to the typical ordinary Perl/Tk application, but I'll document them here for thoroughness.

Several of the methods here alter window manager properties, which often look like WM_PROPERTY_THING. These properties are also traditionally associated with the X Window system on Unix, but some still apply in Win32 systems as well. If a specific method doesn't say anything about which system it applies to, it will apply to both. If it only applies to one or the other (or only half-works in one system), this will be mentioned as well.

13.2.1. Configuring a Toplevel

Both cget and configure methods are used to set and get option values for a toplevel widget. See Appendix A for more detailed information on how to use these methods.

13.2.2. Sizing a Toplevel

You can use the geometry method to define or retrieve a geometry string. A geometry string determines the size and placement of a window ...

Get Learning Perl/Tk now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.