<html> <head> <meta name="description" content="Pmw - a toolkit for building high-level compound widgets in Python"> <meta name="content" content="python, megawidget, mega widget, compound widget, gui, tkinter"> <title>Pmw.LabeledWidget reference manual</title> </head> <body bgcolor="#ffffff" text="#000000" link="#0000ee" vlink="551a8b" alink="ff0000"> <h1 ALIGN="CENTER">Pmw.LabeledWidget</h1> <center><IMG SRC=LabeledWidget.gif ALT="" WIDTH=163 HEIGHT=116></center> <dl> <dt> <h3>Name</h3></dt><dd> <p>Pmw.LabeledWidget() - frame with label </p> </dd> <dt> <h3>Inherits</h3></dt><dd> <a href="MegaWidget.html">Pmw.MegaWidget</a><br> </dd> <dt> <h3>Description</h3></dt><dd> <p> This megawidget consists of an interior frame with an associated label which can be positioned on any side of the frame. The programmer can create other widgets within the interior frame.</p> <p></p> </dd> <dt> <h3>Options</h3></dt><dd> Options for this megawidget and its base classes are described below.<p></p> <a name=option.labelmargin></a> <dl><dt> <strong>labelmargin </strong></dt><dd> Initialisation option. If the <strong>labelpos</strong> option is not <strong>None</strong>, this specifies the distance between the <strong>label</strong> component and the rest of the megawidget. The default is <strong>0</strong>.</p> </dd></dl> <a name=option.labelpos></a> <dl><dt> <strong>labelpos </strong></dt><dd> Initialisation option. Specifies where to place the <strong>label</strong> component. If not <strong>None</strong>, it should be a concatenation of one or two of the letters <strong>'n'</strong>, <strong>'s'</strong>, <strong>'e'</strong> and <strong>'w'</strong>. The first letter specifies on which side of the megawidget to place the label. If a second letter is specified, it indicates where on that side to place the label. For example, if <strong>labelpos</strong> is <strong>'w'</strong>, the label is placed in the center of the left hand side; if it is <strong>'wn'</strong>, the label is placed at the top of the left hand side; if it is <strong>'ws'</strong>, the label is placed at the bottom of the left hand side.</p> <p> If <strong>None</strong>, a label component is not created. The default is <strong>None</strong>.</p> </dd></dl> </dd> <dt> <h3>Components</h3></dt><dd> Components created by this megawidget and its base classes are described below.<p></p> <a name=component.hull></a> <dl><dt> <strong>hull </strong></dt><dd> This acts as the body for the entire megawidget. Other components are created as children of the hull to further specialise this class. By default, this component is a Tkinter.Frame.</p> </dd></dl> <a name=component.label></a> <dl><dt> <strong>label </strong></dt><dd> If the <strong>labelpos</strong> option is not <strong>None</strong>, this component is created as a text label for the megawidget. See the <strong>labelpos</strong> option for details. Note that to set, for example, the <strong>text</strong> option of the label, you need to use the <strong>label_text</strong> component option. By default, this component is a Tkinter.Label.</p> </dd></dl> <a name=component.labelchildsite></a> <dl><dt> <strong>labelchildsite </strong></dt><dd> The frame which can contain other widgets to be labelled. By default, this component is a Tkinter.Frame.</p> </dd></dl> </dd> <a name=methods></a> <dt> <h3>Methods</h3></dt><dd> Only methods specific to this megawidget are described below. For a description of its inherited methods, see the manual for its base class <strong><a href="MegaWidget.html#methods">Pmw.MegaWidget</a></strong>. <p></p> <a name=method.interior></a> <dl><dt> <strong>interior</strong>()</dt><dd> Return the frame within which the programmer may create widgets. This is the same as <code>component('labelchildsite')</code>.</p> </dd></dl> </dd> <dt> <h3>Example</h3></dt><dd> The image at the top of this manual is a snapshot of the window (or part of the window) produced by the following code.<p></p> <pre> class Demo: def __init__(self, parent): # Create a frame to put the LabeledWidgets into frame = Tkinter.Frame(parent, background = 'grey90') frame.pack(fill = 'both', expand = 1) # Create and pack the LabeledWidgets. column = 0 row = 0 for pos in ('n', 'nw', 'wn', 'w'): lw = Pmw.LabeledWidget(frame, labelpos = pos, label_text = pos + ' label') lw.component('hull').configure(relief='sunken', borderwidth=2) lw.grid(column=column, row=row, padx=10, pady=10) cw = Tkinter.Button(lw.interior(), text='child\nsite') cw.pack(padx=10, pady=10, expand='yes', fill='both') # Get ready for next grid position. column = column + 1 if column == 2: column = 0 row = row + 1 </pre> </dd> </dl> <center><P ALIGN="CENTER"> <IMG SRC = blue_line.gif ALT = "" WIDTH=320 HEIGHT=5> </p></center> <font size=-1> <center><P ALIGN="CENTER"> Pmw 1.1 - 26 Aug 2002 - <a href="index.html">Home</a> <br>Manual page last reviewed: 8 November 1998 </p></center> </font> </body> </html>