________________________________________________

OVERVIEW OF THE TKINTER WIDGETS
________________________________________________



For more information on the Tkinter widgets please refer to: http://www.pythonware.com/library/tkinter/introduction/index.htm

  1. The Tkinter Button:
  2. This widget usually allows the user to say "do this now !". They are typically used in toolbars, application windows, and to accept or dismiss data entered into a dialog box.
    For more information on the button widget please refer to: http://www.pythonware.com/library/tkinter/introduction/button.htm

    - Options:
    The options used to describe the Button widget can be found at: http://www.pythonware.com/library/tkinter/introduction/x1366-options.htm

    - Example:
    Here is an example of an inputFormDescr dictionary describing a Button:
    
           >>>from ViewerFramework.gui import InputFormDescr
           >>>idf = InputFormDescr(title ="Button")
           >>>idf.append({'widgetType':Tkinter.Button,
    	              'wcfg':{'borderwidth':7, 'width':10,'height':2,
    		               'text':'BUTTON','relief':Tkinter.RIDGE},
    		      'gridcfg':{'sticky':'ew'}})
           >>>form = self.vf.getUserInput(idf, modal=0, blocking=0)
           

  3. The Tkinter Checkbutton:
  4. The Checkbutton widget is used to implement on-off selections. Checkbuttons can contain text or images, and you can bind a Python function or method to each button. When the button is pressed, Tkinter automatically calls that function or method.
    For more information on the Checkbutton widget please refer to: http://www.pythonware.com/library/tkinter/introduction/checkbutton.htm

    - Options:
    The options used to describe the Checkbutton widget can be found at: http://www.pythonware.com/library/tkinter/introduction/x3565-options.htm

    - Example:
    Here is an example of an inputFormDescr dictionary describing a Checkbutton. An IntVar will be by default associated with the checkbutton if the widget configuration dictionary doesn't contain the variable option.
    
           >>>from ViewerFramework.gui import InputFormDescr
           >>>import Tkinter
           >>>idf = InputFormDescr(title = 'Checkbutton')
           >>>idf.append({'widgetType':Tkinter.Checkbutton,
    	              'name':'checkbutton',
                          'wcfg':{'text':'Checkbutton',
                          'variable':Tkinter.IntVar()},
                          'gridcfg':{'sticky':'w'}})
           >>>val = self.vf.getUserInput(idf)
           

  5. The Tkinter Radiobutton:
  6. The Radiobutton is a standard Tkinter widget used to implement one-of-many selections. Each group of Radiobutton widgets should be associated with single variable. Each button then represents a single value for that variable.
    We also provide support to build group of radiobuttons please also refer to group of Tkinter widgets below. For more information on the Radiobutton widget please refer to: http://www.pythonware.com/library/tkinter/introduction/radiobutton.htm

    - Options:
    The options used to describe a Radiobutton widget can be found at:
    http://www.pythonware.com/library/tkinter/introduction/x6637-options.htm

    - Example:
    Here is an example of an inputFormDescr dictionary describing two Radiobuttons. A StringVar will be by default associated with the radiobutton if the widget configuration dictionary doesn't contain the variable option.
    
         >>>from ViewerFramework.gui import InputFormDescr
         >>>import Tkinter
         >>>idf = InputFormDescr(title = 'Radiobuttons')
         >>>idf.append({'widgetType':Tkinter.Radiobutton,
    	            'name':'radiobutton1',
                        'defaultValue':'Radiobutton1',
                        'wcfg':{'text':'Radiobutton1',
                                'variable':radiobuttonVar,
                                'value':'Radiobutton1'},
                        'gridcfg':{'sticky':'w'}})
         
         >>>idf.append({'widgetType':Tkinter.Radiobutton,
                        'name':'radiobutton2',
                        'defaultValue':'Radiobutton1',
                        'wcfg':{'text':'Radiobutton2',
                                'variable':radiobuttonVar,
                                'value':'Radiobutton2'},
                        'gridcfg':{'sticky':'w'}})
         >>>val = self.vf.getUserInput(idf)
         >>>print val
         

  7. The Tkinter Entry:
  8. The Entry widget is a standard Tkinter widget used to enter or display a single line of text.
    To build an Entry with a label use the Pmw.EntryField widget.
    For more information on the Entry widget please refer to: http://www.pythonware.com/library/tkinter/introduction/entry.htm

    - Options:
    The options used to describe the Entry widget can be found at: http://www.pythonware.com/library/tkinter/introduction/x4069-options.htm

    - Example: Here is an example of an inputFormDescr dictionary describing an Entry. An StringVar will be by default associated with the checkbutton if the widget configuration dictionary doesn't contain the textvariable option.
    
           >>>from ViewerFramework.gui import InputFormDescr
           >>>idf = InputFormDescr(title ="Entry")
           >>>idf.append({'widgetType':Tkinter.Entry,
                          'name':'entry',
    		      'defaultValue':'I am en Entry',
    	              'wcfg':{'textvariable':Tkinter.StringVar(),
    		              'width':20},
    		      'gridcfg':{'sticky':'ew'}})
           >>>form = self.vf.getUserInput(idf)
           

  9. The Tkinter Text:
  10. The Text widget provides formatted text display. It allows you to display and edit text with various styles and attributes. The widget also supports embedded images and windows.For more information on the Text widget please refer to: http://www.pythonware.com/library/tkinter/introduction/text.htm
    If you need a Text widget with scrollbars and a label you can use the Pmw.ScrolledText Widget .

    - Options:
    The options used to describe the Text widget can be found at: http://www.pythonware.com/library/tkinter/introduction/x8518-options.htm

    - Example:
    Here is an example of an inputFormDescr dictionary describing a Text widget.
    
           >>>from ViewerFramework.gui import InputFormDescr
           >>>import Tkinter
           >>>idf = InputFormDescr(title = 'Text')
           >>>idf.append({'widgetType':Tkinter.Text,
    	              'name':'text',
    		      'defaultValue':'I am a Text Widget...',
                          'wcfg':{'width':20,'height':10},
                          'gridcfg':{'sticky':'w'}})
           >>>val = self.vf.getUserInput(idf)
           

  11. The Tkinter Label:
  12. The Label widget is a standard Tkinter widget used to display a text or image on the screen.
    For more information on the Label widget please refer to: http://www.pythonware.com/library/tkinter/introduction/label.htm

    - Options:
    The options used to describe the Text widget can be found at: http://www.pythonware.com/library/tkinter/introduction/x4880-options.htm

    - Example:
    Here is an example of an inputFormDescr dictionary describing a Label widget.
    
    	>>>from ViewerFramework.gui import InputFormDescr
    	>>>import Tkinter
    	>>>idf = InputFormDescr(title = 'Label')
    	>>>idf.append({'widgetType':Tkinter.Label,
    	               'wcfg':{'label':'I am a Label widget'},
                           'gridcfg':{'sticky':'w'}})
            >>>val = self.vf.getUserInput(idf)
    	

  13. The Tkinter Listbox:
  14. Listboxes are used to select from a group of textual items. Depending on how the listbox is configured, the user can select one or many items from that list.

    - Options:
    The options describing a listbox widget can be found at: http://www.pythonware.com/library/tkinter/introduction/x5297-options.htm

    The Listbox widget is not supported by the InputForm because you cannot pass its items as an argument to its constructor.
    However you can use the customizedWidgets.ListChooser or the Pmw.ScrolledListBox widget.

  15. The Tkinter Menu:
  16. The Menu widget is used to implement toplevel, pulldown, and popup menus.
    For more information on the Menu widget please refer to : http://www.pythonware.com/library/tkinter/introduction/menu.htm

    - Options:
    The options describing the Menu widget can be found at : http://www.pythonware.com/library/tkinter/introduction/x5740-options.htm

    - Example:
    Sorry no example available for this widget :(

  17. The Tkinter Message:
  18. The message widget is used to display multiple lines of text. It's very similar to a plain Label, but can adjust its width to maintain a given aspect ratio.
    For more information on the Message widget please refer to: http://www.pythonware.com/library/tkinter/introduction/message.htm

    - Options:
    The options describing the Message widget can be found at : http://www.pythonware.com/library/tkinter/introduction/x5937-options.htm

    - Example:
    Here is an example of an inputFormDescr dictionary describing a Message widget.
    
           >>>from ViewerFramework.gui import InputFormDescr
           >>>import Tkinter
           >>>idf = InputFormDescr(title = 'Message')
           >>>idf.append({'widgetType':Tkinter.Message,
    		      'wcfg':{'text':'I am a Message widget...',
    		      'width':10},
                          'gridcfg':{'sticky':'w'}})
           >>>val = self.vf.getUserInput(idf)
           

  19. The Tkinter Scale:
  20. For more information on the Scale widget please refer to : http://www.pythonware.com/library/tkinter/introduction/scale.htm

    - Options:
    The options describing the Scale widget can be found at: http://www.pythonware.com/library/tkinter/introduction/x6943-options.htm

    - Example:
    Here is an example of an inputFormDescr dictionary describing a Scale widget.
    
           >>>from ViewerFramework.gui import InputFormDescr
           >>>import Tkinter
           >>>idf = InputFormDescr(title = 'Scale')
           >>>idf.append({'widgetType':Tkinter.Scale,
    	              'name':'scale',
    		      'defaultValue':5,
    		      'wcfg':{'variable':Tkinter.IntVar(),
    		      'from':0, 'to':20},
                          'gridcfg':{'sticky':'we'}})
           >>>val = self.vf.getUserInput(idf)
           

  21. The Tkinter Scrollbar:
  22. This widget is used to implement scrolled listboxes, canvases, and textfields. All these widgets are available as Python Mega Widgets or also as the customized Widgets.
    For more information on the scrollbar widget please refer to: http://www.pythonware.com/library/tkinter/introduction/scrollbar.htm

    - Options:
    The options describing the scrollbar widget can be found at http://www.pythonware.com/library/tkinter/introduction/x7270-options.htm

  23. The Tkinter Canvas:
  24. The Canvas widget provides structured graphics facilities for Tkinter. This is a highly versatile widget which are used to draw graphs and plots, create graphics editors, and implement various kinds of custom widgets.
    Sorry you cannot yet use the Canvas widget as a container using InputForm :( But you can create a customizedWidgets using a Canvas widget.

    - Options:
    The options describing a Canvas widget can be found at: http://www.pythonware.com/library/tkinter/introduction/x2222-options.htm

  25. Group of Tkinter Widgets:
  26. We created this widgetType to build groups of widget of the same kind more easily. It is generally used to build a group of radiobuttons. The widgets belonging to the same group only differs by their text or label.

    - Options:
    The inputFormDescr dictionary used to create a group of widget of the same type should contain the following couples (option:value), on top of the ones listed in the chapter presenting the inputFormDescr class .

    direction specifies the direction to organize the widgets of the group if different from the defaultDirection.
    groupedBy When you want to subdivide your group, this flag specifies how many widget you want per subgroup. It adds another control on the way the widgets are organized in the form.
    listtext List of the option text of your tkinter widget if it has one..

    - Example:

    Here is an example of an inputFormDescr dictionary describing a group of radiobuttons.
           >>>from ViewerFramework.gui import InputFormDescr
           >>>import Tkinter
           >>># Define the Tkinter variable shared by all the radiobutton.
           >>>icecream = Tkinter.StringVar()
           >>>idf = InputFormDescr(title="Group of Radiobutton")
           >>>flavors = ['rasberry', 'strawberry','chocolate', 'vanilla',
    	             'pecan','peach','apricot','pear']
           >>># Added some space so all the widgets are aligned.
           >>>idf.append({'name': 'groupOfRadiobuttons',
    		      'widgetType': Tkinter.Radiobutton,
    		      'listtext': flavors,
                          'groupedBy':3,
                          'defaultValue':'chocolate',
                          'wcfg':{'variable':'icecream'},
                          'gridcfg':{'sticky':Tkinter.W}})
           >>>val = self.vf.getUserInput(idf)
           >>>print val
           
           




________________________________________________


Sophie Coon
July 2000
For suggestions or more information please contact:

  mgltools@scripps.edu