Pmw.Group reference manual
Description: Pmw - a toolkit for building high-level compound widgets in Python

# Pmw.Group

### Name

  Pmw.Group() - frame with ring border and tag

### Inherits

  Pmw.MegaWidget

### Description

  This megawidget consists of an interior frame with an exterior ring border and an identifying tag displayed over the top edge of the ring. The programmer can create other widgets within the interior frame.

### Options

  Options for this megawidget and its base classes are described below.

  collapsedheight
    Initialisation option. The distance from the bottom of the tag to the bottom of the ring when the groupchildsite is collapsed. The default is 6.
  collapsedwidth
    Initialisation option. When the groupchildsite is collapsed, the width of the ring is set to the width of the tag plus collapsedwidth. The default is 20.
  tagindent
    Initialisation option. The distance from the left edge of the ring to the left side of the tag component. The default is 10.

### Components

  Components created by this megawidget and its base classes are described below.

  groupchildsite
    The frame which can contain other widgets to be grouped. By default, this component is a tkinter.Frame.
  hull
    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.
  ring
    This component acts as the enclosing ring around the groupchildsite. The default borderwidth is 2 and the default relief is 'groove'. By default, this component is a tkinter.Frame.
  tag
    The identifying tag displayed over the top edge of the enclosing ring. If the pyclass for this component is None, (ie: `tag_pyclass = None`, then no tag component is created. By default, this component is a tkinter.Label.

### Methods

  Only methods specific to this megawidget are described below. For a description of its inherited methods, see the manual for its base class Pmw.MegaWidget.

  collapse()
    Do not display the groupchildsite component.
  expand()
    Display the groupchildsite component.
  interior()
    Return the frame within which the programmer may create widgets. This is the same as `component('groupchildsite')`.
  toggle()
    Display the groupchildsite component if it is currently hidden and hide it if it is currently displayed.

### Example

  The image at the top of this manual is a snapshot of the window (or part of the window) produced by the following code.

      class Demo:
          def __init__(self, parent):

              # Create and pack the Groups.
              w = Pmw.Group(parent, tag_text='label')
              w.pack(fill = 'both', expand = 1, padx = 6, pady = 6)
              cw = tkinter.Label(w.interior(),
                      text = 'A group with the\ndefault Label tag')
              cw.pack(padx = 2, pady = 2, expand='yes', fill='both')

              w = Pmw.Group(parent, tag_pyclass = None)
              w.pack(fill = 'both', expand = 1, padx = 6, pady = 6)
              cw = tkinter.Label(w.interior(), text = 'A group\nwithout a tag')
              cw.pack(padx = 2, pady = 2, expand='yes', fill='both')

              radiogroups = []
              self.var = tkinter.IntVar()
              self.var.set(0)
              radioframe = tkinter.Frame(parent)
              w = Pmw.Group(radioframe,
                      tag_pyclass = tkinter.Radiobutton,
                      tag_text='radiobutton 1',
                      tag_value = 0,
                      tag_variable = self.var)
              w.pack(fill = 'both', expand = 1, side='left')
              cw = tkinter.Frame(w.interior(),width=200,height=20)
              cw.pack(padx = 2, pady = 2, expand='yes', fill='both')
              radiogroups.append(w)

              w = Pmw.Group(radioframe,
                      tag_pyclass = tkinter.Radiobutton,
                      tag_text='radiobutton 2',
                      tag_font = Pmw.logicalfont('Helvetica', 4),
                      tag_value = 1,
                      tag_variable = self.var)
              w.pack(fill = 'both', expand = 1, side='left')
              cw = tkinter.Frame(w.interior(),width=200,height=20)
              cw.pack(padx = 2, pady = 2, expand='yes', fill='both')
              radiogroups.append(w)
              radioframe.pack(padx = 6, pady = 6, expand='yes', fill='both')
              Pmw.aligngrouptags(radiogroups)

              w = Pmw.Group(parent,
                      tag_pyclass = tkinter.Checkbutton,
                      tag_text='checkbutton',
                      tag_foreground='blue')
              w.pack(fill = 'both', expand = 1, padx = 6, pady = 6)
              cw = tkinter.Frame(w.interior(),width=150,height=20)
              cw.pack(padx = 2, pady = 2, expand='yes', fill='both')

              w = Pmw.Group(parent,
                      collapsedwidth = 70,
                      tag_pyclass = tkinter.Button,
                      tag_text='Show/Hide')
              w.configure(tag_command = w.toggle)
              w.pack(expand = 0, padx = 6, pady = 6)
              cw = tkinter.Label(w.interior(),
                      background = 'aliceblue',
                      text = 'Now you see me.\nNow you don\'t.'
              )
              cw.pack(padx = 2, pady = 2, expand='yes', fill='both')

Pmw 2.1 - 31 Dec 2020 - Home
Manual page last reviewed: 15 November 1998