Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | import Tkinter |
2 | import Pmw | |
3 | ||
4 | class LabeledWidget(Pmw.MegaWidget): | |
5 | def __init__(self, parent = None, **kw): | |
6 | ||
7 | # Define the megawidget options. | |
8 | INITOPT = Pmw.INITOPT | |
9 | optiondefs = ( | |
10 | ('labelmargin', 0, INITOPT), | |
11 | ('labelpos', None, INITOPT), | |
12 | ('sticky', 'nsew', INITOPT), | |
13 | ) | |
14 | self.defineoptions(kw, optiondefs) | |
15 | ||
16 | # Initialise the base class (after defining the options). | |
17 | Pmw.MegaWidget.__init__(self, parent) | |
18 | ||
19 | # Create the components. | |
20 | interior = Pmw.MegaWidget.interior(self) | |
21 | self._labelChildSite = self.createcomponent('labelchildsite', | |
22 | (), None, | |
23 | Tkinter.Frame, (interior,)) | |
24 | self._labelChildSite.grid(column=2, row=2, sticky=self['sticky']) | |
25 | interior.grid_columnconfigure(2, weight=1) | |
26 | interior.grid_rowconfigure(2, weight=1) | |
27 | ||
28 | self.createlabel(interior) | |
29 | ||
30 | # Check keywords and initialise options. | |
31 | self.initialiseoptions() | |
32 | ||
33 | def interior(self): | |
34 | return self._labelChildSite |