TkXtra - Extended Tk widgets for Python
TkXtra is a collection of combination and enhanced widgets for Tk built in
Python + Tkinter. The eventual goal of this project is to provide a set of
widgets which are as useful and powerful as those found in Tix which uses
Tcl/Tk and C. You can download the latest version
here (TkXtra-0.1.tar.gz, 36K)
or here (tkxtra01.zip 41K) for our
friends who must use Windoze. These are http links so you may need to
use shift-click in Netscape to download.
Sometime late last year, I had developed an interface from Python to Tix
called PyTix. I didn't want to use Tcl but the Tix
widgets (quite popular
in the Tcl world) were unusable from Python. Sometime this year, Tix
decided to go commercial. At that time, I thought, I might as well try to
develop the same widget set using raw Tk in Python and I started on TkXtra.
Since it was not complete, I refrained from releasing it until I received
some queries about it. Now that Tix is again non-commercial, TxXtra is
probably no longer required. On the other hand,
maybe some people will find it useful for one of the following reasons -
- TkXtra depends only on Python and Tkinter. No version hassles as in
Tix because we don't use Tcl/Tk internals.
- Easily modifiable and extensible since it is written in Python.
Subclassing of widgets is straight forward.
- It helps people understand what can be done with just Python and
I have changed the license terms from the general GPL to the less
restrictive LGPL in response to one complaint. Noone can say I'm uncooperative :-)
At present, the TkXtra widget set is not complete. Currently the following
widgets are implemented.
- ScrolledText - A wrapper for a Text widget and vertical and
horizontal scrollbars. The scrollbars appear only when necessary by
- ScrolledList - A wrapper for a Listbox and a vertical
scrollbar. The scrollbar appears only when necessary by default.
- PanedWindow - A widget that can have multiple panes separated
by a window sash. The panes may be dynamically resized by the user by
dragging the sash. Panes can be organized either horizontally or
- ButtonBox - A container for Button widgets. Organizes them
vertically or horizontally.
- SelectBox - A radio-button group like container except that the
buttons are regular buttons instead of checkboxes.
- LabelledFrame - A container for a frame. Has a label and a border
drawn around the frame.
- LabelledEntry - A composite widget wrapping a Label and an
Entry widget. It also provides a callback for when the value is changed.
- NumericEntry - Like a LabelledEntry except that it accepts only
numbers as input. Numbers entered are formatted with commas etc.
- NumericNudgeEntry - Same as NumericEntry except that there are
two small arrows on the side of the Entry widget. Pressing them
increments/decrements the value in the Entry by a user defined amount.
- DateEntry - Like NumericEntry but for dates.
- DateNudgeEntry - Like NumericNudgeEntry but for dates.
- ComboBox - An entry widget with a drop down list of predefined
values. The widget can be constrained to accept only these strings as
input. Typing the first few letters of a choice (if they are unique) will
select that item.
The ScrolledText and ScrolledList widgets sometimes don't show their
scrollbars until resized (even by 1 pixel). If anyone figures out why,
please tell me.
In the immediate future, I plan on adding the Notebook and HList / DirList
widgets (Tix terminology). If all goes well - bugs are identified and
fixed, the widgets look more finished than they are now etc., I will
transfer some of the code to C to increase performance. At present
performance is pretty good on a Sparc 10. However, some aspects are slow
e.g., resizing panes in a PanedWindow widget (no longer true as of 0.1).
Please send all bugs, suggestions for improvements, bug fixes and the like
Back to Sudhir's Home Page