Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | |
2 | <html> | |
3 | <head> | |
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> | |
7 | </head> | |
8 | ||
9 | <body bgcolor="#ffffff" text="#000000" link="#0000ee" | |
10 | vlink="551a8b" alink="ff0000"> | |
11 | ||
12 | <h1 ALIGN="CENTER">Pmw.LabeledWidget</h1> | |
13 | ||
14 | <center><IMG SRC=LabeledWidget.gif ALT="" WIDTH=163 HEIGHT=116></center> | |
15 | <dl> | |
16 | <dt> <h3>Name</h3></dt><dd> | |
17 | <p>Pmw.LabeledWidget() - | |
18 | frame with label | |
19 | </p> | |
20 | ||
21 | ||
22 | </dd> | |
23 | <dt> <h3>Inherits</h3></dt><dd> | |
24 | <a href="MegaWidget.html">Pmw.MegaWidget</a><br> | |
25 | </dd> | |
26 | <dt> <h3>Description</h3></dt><dd> | |
27 | <p> | |
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> | |
31 | ||
32 | <p></p> | |
33 | ||
34 | ||
35 | </dd> | |
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 | |
41 | </strong></dt><dd> | |
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> | |
45 | ||
46 | ||
47 | </dd></dl> | |
48 | <a name=option.labelpos></a> | |
49 | <dl><dt> <strong>labelpos | |
50 | </strong></dt><dd> | |
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> | |
62 | ||
63 | ||
64 | ||
65 | </dd></dl> | |
66 | <a name=option.sticky></a> | |
67 | <dl><dt> <strong>sticky | |
68 | </strong></dt><dd> | |
69 | Initialisation option. The default is <strong>'nsew'</strong>.</p> | |
70 | ||
71 | ||
72 | </dd></dl> | |
73 | </dd> | |
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> | |
78 | <dl><dt> <strong>hull | |
79 | </strong></dt><dd> | |
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> | |
83 | ||
84 | ||
85 | </dd></dl> | |
86 | <a name=component.label></a> | |
87 | <dl><dt> <strong>label | |
88 | </strong></dt><dd> | |
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> | |
94 | ||
95 | ||
96 | </dd></dl> | |
97 | <a name=component.labelchildsite></a> | |
98 | <dl><dt> <strong>labelchildsite | |
99 | </strong></dt><dd> | |
100 | The frame which can contain other widgets to be labelled. By default, this component is a Tkinter.Frame.</p> | |
101 | ||
102 | ||
103 | </dd></dl> | |
104 | </dd> | |
105 | <a name=methods></a> | |
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>. | |
111 | <p></p> | |
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> | |
116 | ||
117 | ||
118 | </dd></dl> | |
119 | </dd> | |
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> | |
124 | <pre> | |
125 | class Demo: | |
126 | def __init__(self, parent): | |
127 | ||
128 | # Create a frame to put the LabeledWidgets into | |
129 | frame = Tkinter.Frame(parent, background = 'grey90') | |
130 | frame.pack(fill = 'both', expand = 1) | |
131 | ||
132 | # Create and pack the LabeledWidgets. | |
133 | column = 0 | |
134 | row = 0 | |
135 | for pos in ('n', 'nw', 'wn', 'w'): | |
136 | lw = Pmw.LabeledWidget(frame, | |
137 | labelpos = pos, | |
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') | |
143 | ||
144 | # Get ready for next grid position. | |
145 | column = column + 1 | |
146 | if column == 2: | |
147 | column = 0 | |
148 | row = row + 1 | |
149 | ||
150 | </pre> | |
151 | </dd> | |
152 | </dl> | |
153 | ||
154 | <center><P ALIGN="CENTER"> | |
155 | <IMG SRC = blue_line.gif ALT = "" WIDTH=320 HEIGHT=5> | |
156 | </p></center> | |
157 | ||
158 | ||
159 | <font size=-1> | |
160 | <center><P ALIGN="CENTER"> | |
161 | Pmw 1.2 - | |
162 | 5 Aug 2003 | |
163 | - <a href="index.html">Home</a> | |
164 | <br>Manual page last reviewed: 8 November 1998 | |
165 | </p></center> | |
166 | </font> | |
167 | ||
168 | </body> | |
169 | </html> | |
170 |