"""
Radio Buttons:

Set up a group of radio buttons using a list and QButtonGroup
"""

        # These are the button captions

        buttons = ["QuestionYesNo", "WarningYesNo", "WarningContiueCancel", "WarningYesNoCancel",\
                   "Information", "Sorry", "Error"]

        # Needed in a few places, so just compute it once

        n = len (buttons)

        # n -- the number of "strips" - rows in this case
        # Qt.Vertical -- arrange the radio buttons top to bottom
        # "MessageBoxes" -- the group title (displayed)
        # self -- the QWidget derived parent
        # "button grp" -- an optional name for the object

        grp = QButtonGroup (n, Qt.Vertical, "MessageBoxes", self, "button grp")

        # make it big enough to display the widest member and entire list

        grp.setGeometry (10, 10, 150, 25*n)

        # loop to set up buttons
        # The caption comes from the list
        # Making 'grp' the parent widget automatically inserts
        # the radio buttons in the QButtonGroup box

        for i in range (n):
            QRadioButton (buttons [i], grp)

        # When a button is clicked, call a method (self.launch in this case)
        # The method will receive an int indicating the index of the
        # button clicked (indices are assigned from 0 in the order in
        # which the radio button was added to the QButtonGroup)

        self.connect (grp, SIGNAL ("clicked (int)"), self.launch)

    def launch (self, which):
        # do something with the button click
        # 'which' is the index of the button clicked, which
        # will correspond to its position in the list (if the
        # code above is used to construct the button group)

        print button [which]

