Package VisionEgg :: Module GUI :: Class GetKeypressDialog |
[frames] | no frames]

# Class GetKeypressDialog

source code

        ??-109 --+
                 |
    ToplevelDialog --+
                     |
                    GetKeypressDialog

    Open a dialog box which returns when a valid key is pressed.

    Arguments are:
    master - a Tkinter widget (defaults to None)
    title - a string for the title bar of the widget
    text - a string to display as the text in the body of the dialog
    key_list - a list of acceptable keys, e.g. ['q','1','2','<Return>']

    The following example will print whatever character was pressed:
    d = GetKeypressDialog(key_list=['q','1','2','<Return>','<Escape>'])
    print d.result

    The implementation is somewhat obscure because a new Tk/Tcl
    interpreter may be created if this Dialog is called with no
    master widget.

Instance Methods
__init__(self, title="Press a key", text="Press a key", key_list=[], **kw) | source code
keypress(self, tkinter_event) | source code
Inherited from `ToplevelDialog`: `destroy`

Method Details

### __init__(self, title="Press a key", text="Press a key", key_list=[], **kw) (Constructor) | source code
Overrides: ToplevelDialog.__init__