Showing posts with label Tkinter Demos. Show all posts
Showing posts with label Tkinter Demos. Show all posts

Sunday, September 2, 2012

Tkinter Floorplan Demo

This code is based on the Tcl floor.tcl demo which is a demonstration of the floorplan for DEC's Western Research Laboratory. The user can click on a floor to bring it to the front, mouse over a room to see it highlighted or enter a floor number in the textbook to have it highlighted.


Friday, August 31, 2012

Tkinter Built-in Bitmap Demo

This code is based on the Tcl bitmap.tcl demo. The demo displays the built-in bitmaps available on all systems; a number of other are available for Macs.

Tkinter Pendulum Demo

This code is based on the Tcl pendulum.tcl demo. It presents a simple, rotational, pendulum; sets it in motion and draws the pendulum's phase space. The user can change the position of the pendulum by clicking in the Pendulum Simulation panel.


Wednesday, August 29, 2012

Tkinter Animated Wave Demo

This code is based on the Tcl aniwave.tcl demo. A wave frequency line is drawn and animated, moving the frequency peak from right to left and back along the line.


Monday, August 27, 2012

Tkinter Animated Labels Demo

This code is based on the Tcl anilabel.tcl demo. It displays three labels with scrolling text and an animated GIF which is animated by rotating through it's animation frames.

Sunday, August 26, 2012

Tkinter Color Picker Demo

This code is based on the Tcl clrpick.tcl demo.



Clicking on one of the buttons pops up the native color picker dialog, which, in Windows is


Once a color is chosen either the background or foreground color of the widgets are changed.


Note that the background Style option for ttk.Button, in Windows, only changes the buttons highlight area and not the entire button background.

Saturday, August 25, 2012

Tkinter FileDialog Demo

This code is based on the Tcl filebox.tcl demo.  It demonstrates calls to FileDialog.


Tkinter Message Box Demo

This code is based on the Tcl msgbox.tcl demo. Select an icon and type then press the Show Message Box to see the configured message box.

Thursday, August 23, 2012

Tkinter Dockable Toolbar Demo

This code is based on the Tcl toolbar.tcl demo. It demonstrates the creation of toolbar which can be torn-off,  and restored to, the main application window.


Wednesday, August 22, 2012

Tkinter Menubutton Demo

This code is based on the Tcl menubu.tcl demo. It demonstrates the use of ttk.Menubutton as well as ttk.OptionMenu.  The button labels refer to the positions of the popup-menus and not the position of the budget within the window.



Tuesday, August 21, 2012

Tkinter Menu Demo

This code is based on the Tcl menu.tcl demo. It demonstrates creating top level, cascading menus some of which include icons, radio and check buttons, as well as short-cut keys and accelerator keys. Only the Colors menu is implemented as a tear-off; a menu that can be opened as a separate window.




Sunday, August 19, 2012

Tkinter Notebook Demo

This code is based on the Tcl ttknote.tcl demo. A ttk.Notebook with three tabs, one disabled, is displayed.

Saturday, August 18, 2012

Tkinter Nested Paned Windows Demo

This code is based on the Tcl ttkpane.tcl demo. A number of nested paned windows are created to which widgets are added. Draggable sashes exist between each of the nested panes i.e. between the Button and Clocks, Progress and Text and between the two panes holding the foregoing. The code makes use of the Tcl/Tk clock command to update the clock labels every 1000ms.

Tkinter Vertical Paned Window Demo

This code is based on the Tcl paned2.tcl demo.


Tkinter Horizontal Paned Window Demo

This code is based on the Tcl paned1.tcl demo; uses ttk.PanedWindow rather than the tkinter PanedWindow.



Tkinter ProgressBar Demo

This code is based on the Tcl ttkprogress.tcl demo.


Friday, August 17, 2012

Tkinter Vertical Scale Demo

This code is based on the Tcl vscale.tcl demo. A vertical ttk.Scale is displayed along with an arrow (canvas polygon item). Drag the scale to change the length of the arrow.


Tkinter Horizontal Scale Demo

This code is based on the Tcl hscale.tcl demo.  A horizontal ttk.Scale is displayed along with an arrow (canvas polygon item). Drag the scale to stretch or shrink the arrow.



Tkinter Knight's Tour Demo

This code is based on the Tcl knightstour.tcl demo written by Pat Thoyts. The demo uses a Canvas widget (to display a chessboard), a Text widget, a Button, CheckboxButton, and Scale (to control the tour).

Initially, a chessboard is displayed with a single chess piece, a black knight, who may be dragged to another square. Below the board are three controls: a Start button, a Repeat checkbox and a Speed scale. Pressing Start begins the tour which is calculated using an enhanced Warnsdorff's rule (see the original tcl file for more info). As the knight begins to move around the board, the position changes are recorded in the text widget to the right of the board. Drag the scale to change the speed with which the knight is moved. Click the Repeat checkbox to run random tours continuously.

Note that the knight will disappear if dragged off the board; hit Start to have him repositioned.



Wednesday, August 15, 2012

Tkinter Text Embedded Windows Demo

This code is based on the Tcl twind.tcl demo. A text widget is created with embedded buttons, a horizontal scrollbar that can be turned on or off, and a canvas object which is created and destroyed on the fly. The code makes use of text tags (to handle the layout of the colour buttons) and marks (to handle the insertion and removal of the canvas object).

The original Tcl demo includes code to create peer and split windows; however, the Text.peer_create() method is not available in Python 3.2.3 under Windows.