Sunday, July 29, 2012

Tkinter Entry with scrollbar Demo

This code is based on the Tcl entry2.tcl demo. It displays 3 basic, single line entry fields, each with their own horizontal scrollbar.


Tkinter Entry without scroll Demo

This code is based on Tcl entry1.tcl demo. It displays three basic, single line entry fields.

Tkinter Treeview Demo

This code is based on the Tcl tree.tcl demo with reference to the Python example, dirbrowser.py.  The Tcl demo displays all system drives and all directories and files.  There doesn't appear to be a simple Pythonic way to do the same and, as the main intent is to demonstrate building a tree hierarchy, I've opted to only display the current working directory.



Thursday, July 26, 2012

Tkinter Multi-Column List Demo

This code is based on the Tcl mclist.tcl demo, and, gratefully, demo code at svn.python.org.  While the demo is for a list it is actually based on the ttk.Treeview widget and not a listbox.


Tkinter assigns the same identifier to the values in each column of the same row. For example, Argentina, Buenos Ares and ARS all have I001 as their identifier while the United States, Washington, DC and USD all have the identifier I00F.  When sorting a column, you only need to move the selected column values, tkinter handles moving related items in the same row.

Tkinter Listbox Famous Sayings Demo

This code is based on the Tcl sayings.tcl demo; it demonstrates the use of both Horizontal and Vertical scrollbars within a Listbox as well as resizing properties; when the window is maximized the listbox is given the extra space.

Tkinter Listbox Colours Demo

This code is based on the Tcl colors.tcl demo. Note that the colours you get are not always those you'd think you'd see given the colour name. You may also want to check out John Grayson's colorswatch.py


Tkinter Listbox States Demo

The code is based on the Tcl states.tcl demo. It presents a simple Listbox populated with the names of the US States. Currently there is no ttk.Listbox; however, the ttk.Scrollbar can be used with the tkinter Listbox widget.