4 <meta name="description" content="Pmw - a toolkit for building high-level compound widgets in Python">
5 <meta name="content" content="python, megawidget, mega widget, compound widget, gui, tkinter">
6 <title>Pmw.LabeledWidget reference manual</title>
9 <body bgcolor="#ffffff" text="#000000" link="#0000ee"
10 vlink="551a8b" alink="ff0000">
12 <h1 ALIGN="CENTER">Pmw.LabeledWidget</h1>
14 <center><IMG SRC=LabeledWidget.gif ALT="" WIDTH=163 HEIGHT=116></center>
16 <dt> <h3>Name</h3></dt><dd>
17 <p>Pmw.LabeledWidget() -
23 <dt> <h3>Inherits</h3></dt><dd>
24 <a href="MegaWidget.html">Pmw.MegaWidget</a><br>
26 <dt> <h3>Description</h3></dt><dd>
28 This megawidget consists of an interior frame with an associated
29 label which can be positioned on any side of the frame. The
30 programmer can create other widgets within the interior frame.</p>
36 <dt> <h3>Options</h3></dt><dd>
37 Options for this megawidget and its base
38 classes are described below.<p></p>
39 <a name=option.labelmargin></a>
40 <dl><dt> <strong>labelmargin
42 Initialisation option. If the <strong>labelpos</strong> option is not <strong>None</strong>, this specifies the
43 distance between the <strong>label</strong> component and the rest of the
44 megawidget. The default is <strong>0</strong>.</p>
48 <a name=option.labelpos></a>
49 <dl><dt> <strong>labelpos
51 Initialisation option. Specifies where to place the <strong>label</strong> component. If not
52 <strong>None</strong>, it should be a concatenation of one or two of the
53 letters <strong>'n'</strong>, <strong>'s'</strong>, <strong>'e'</strong> and <strong>'w'</strong>. The first letter
54 specifies on which side of the megawidget to place the label.
55 If a second letter is specified, it indicates where on that
56 side to place the label. For example, if <strong>labelpos</strong> is <strong>'w'</strong>,
57 the label is placed in the center of the left hand side; if
58 it is <strong>'wn'</strong>, the label is placed at the top of the left
59 hand side; if it is <strong>'ws'</strong>, the label is placed at the
60 bottom of the left hand side.</p>
61 <p> If <strong>None</strong>, a label component is not created. The default is <strong>None</strong>.</p>
66 <a name=option.sticky></a>
67 <dl><dt> <strong>sticky
69 Initialisation option. The default is <strong>'nsew'</strong>.</p>
74 <dt> <h3>Components</h3></dt><dd>
75 Components created by this megawidget and its base
76 classes are described below.<p></p>
77 <a name=component.hull></a>
80 This acts as the body for the entire megawidget. Other components
81 are created as children of the hull to further specialise this
82 class. By default, this component is a Tkinter.Frame.</p>
86 <a name=component.label></a>
87 <dl><dt> <strong>label
89 If the <strong>labelpos</strong> option is not <strong>None</strong>, this component is
90 created as a text label for the megawidget. See the
91 <strong>labelpos</strong> option for details. Note that to set, for example,
92 the <strong>text</strong> option of the label, you need to use the <strong>label_text</strong>
93 component option. By default, this component is a Tkinter.Label.</p>
97 <a name=component.labelchildsite></a>
98 <dl><dt> <strong>labelchildsite
100 The frame which can contain other widgets to be labelled. By default, this component is a Tkinter.Frame.</p>
106 <dt> <h3>Methods</h3></dt><dd>
107 Only methods specific to this megawidget are described below.
108 For a description of its inherited methods, see the
109 manual for its base class
110 <strong><a href="MegaWidget.html#methods">Pmw.MegaWidget</a></strong>.
112 <a name=method.interior></a>
113 <dl><dt> <strong>interior</strong>()</dt><dd>
114 Return the frame within which the programmer may create widgets.
115 This is the same as <code>component('labelchildsite')</code>.</p>
120 <dt> <h3>Example</h3></dt><dd>
121 The image at the top of this manual is a snapshot
122 of the window (or part of the window) produced
123 by the following code.<p></p>
126 def __init__(self, parent):
128 # Create a frame to put the LabeledWidgets into
129 frame = Tkinter.Frame(parent, background = 'grey90')
130 frame.pack(fill = 'both', expand = 1)
132 # Create and pack the LabeledWidgets.
135 for pos in ('n', 'nw', 'wn', 'w'):
136 lw = Pmw.LabeledWidget(frame,
138 label_text = pos + ' label')
139 lw.component('hull').configure(relief='sunken', borderwidth=2)
140 lw.grid(column=column, row=row, padx=10, pady=10)
141 cw = Tkinter.Button(lw.interior(), text='child\nsite')
142 cw.pack(padx=10, pady=10, expand='yes', fill='both')
144 # Get ready for next grid position.
154 <center><P ALIGN="CENTER">
155 <IMG SRC = blue_line.gif ALT = "" WIDTH=320 HEIGHT=5>
160 <center><P ALIGN="CENTER">
163 - <a href="index.html">Home</a>
164 <br>Manual page last reviewed: 8 November 1998