diff options
author | Georg Brandl <georg@python.org> | 2010-12-30 21:33:07 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2010-12-30 21:33:07 (GMT) |
commit | 7fafbc95c0c963438197c9a43fe893c4ea6fe759 (patch) | |
tree | 5c9ceda4bdc5260236a230554b9ed56b8c0cdbd3 /Demo/tix | |
parent | 6f17e2df29a865a29447531e89fb22be710e382d (diff) | |
download | cpython-7fafbc95c0c963438197c9a43fe893c4ea6fe759.zip cpython-7fafbc95c0c963438197c9a43fe893c4ea6fe759.tar.gz cpython-7fafbc95c0c963438197c9a43fe893c4ea6fe759.tar.bz2 |
More cleanup: Move some demos into a dedicated Tools/demo dir, move 2to3 demo to Tools, and remove all the other Demo content.
Diffstat (limited to 'Demo/tix')
40 files changed, 0 insertions, 3174 deletions
diff --git a/Demo/tix/INSTALL.txt b/Demo/tix/INSTALL.txt deleted file mode 100644 index ac70b68..0000000 --- a/Demo/tix/INSTALL.txt +++ /dev/null @@ -1,89 +0,0 @@ -$Id$ - -Installing Tix.py ----------------- - -0) To use Tix.py, you need Tcl/Tk (V8.3.3), Tix (V8.1.1) and Python (V2.1.1). - Tix.py has been written and tested on a Intel Pentium running RH Linux 5.2 - and Mandrake Linux 7.0 and Windows with the above mentioned packages. - - Older versions, e.g. Tix 4.1 and Tk 8.0, might also work. - - There is nothing OS-specific in Tix.py itself so it should work on - any machine with Tix and Python installed. You can get Tcl and Tk - from http://dev.scriptics.com and Tix from http://tix.sourceforge.net. - -1) Build and install Tcl/Tk 8.3. Build and install Tix 8.1. - Ensure that Tix is properly installed by running tixwish and executing - the demo programs. Under Unix, use the --enable-shared configure option - for all three. We recommend tcl8.3.3 for this release of Tix.py. - -2a) If you have a distribution like ActiveState with a tcl subdirectory - of $PYTHONHOME, which contains the directories tcl8.3 and tk8.3, - make a directory tix8.1 as well. Recursively copy the files from - <tix>/library to $PYTHONHOME/lib/tix8.1, and copy the dynamic library - (tix8183.dll or libtix8.1.8.3.so) to the same place as the tcl dynamic - libraries ($PYTHONHOME/Dlls or lib/python-2.1/lib-dynload). In this - case you are all installed, and you can skip to the end. - -2b) Modify Modules/Setup.dist and setup.py to change the version of the - tix library from tix4.1.8.0 to tix8.1.8.3 - These modified files can be used for Tkinter with or without Tix. - -3) The default is to build dynamically, and use the Tcl 'package require'. - To build statically, modify the Modules/Setup file to link in the Tix - library according to the comments in the file. On Linux this looks like: - -# *** Always uncomment this (leave the leading underscore in!): -_tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \ -# *** Uncomment and edit to reflect where your Tcl/Tk libraries are: - -L/usr/local/lib \ -# *** Uncomment and edit to reflect where your Tcl/Tk headers are: - -I/usr/local/include \ -# *** Uncomment and edit to reflect where your X11 header files are: - -I/usr/X11R6/include \ -# *** Or uncomment this for Solaris: -# -I/usr/openwin/include \ -# *** Uncomment and edit for BLT extension only: -# -DWITH_BLT -I/usr/local/blt/blt8.0-unoff/include -lBLT8.0 \ -# *** Uncomment and edit for PIL (TkImaging) extension only: -# (See http://www.pythonware.com/products/pil/ for more info) -# -DWITH_PIL -I../Extensions/Imaging/libImaging tkImaging.c \ -# *** Uncomment and edit for TOGL extension only: -# -DWITH_TOGL togl.c \ -# *** Uncomment and edit for Tix extension only: - -DWITH_TIX -ltix8.1.8.3 \ -# *** Uncomment and edit to reflect your Tcl/Tk versions: - -ltk8.3 -ltcl8.3 \ -# *** Uncomment and edit to reflect where your X11 libraries are: - -L/usr/X11R6/lib \ -# *** Or uncomment this for Solaris: -# -L/usr/openwin/lib \ -# *** Uncomment these for TOGL extension only: -# -lGL -lGLU -lXext -lXmu \ -# *** Uncomment for AIX: -# -lld \ -# *** Always uncomment this; X11 libraries to link with: - -lX11 - -4) Rebuild Python and reinstall. - -You should now have a working Tix implementation in Python. To see if all -is as it should be, run the 'tixwidgets.py' script in the Demo/tix directory. -Under X windows, do - /usr/local/bin/python Demo/tix/tixwidgets.py - -If this does not work, you may need to tell python where to find -the Tcl, Tk and Tix library files. This is done by setting the -TCL_LIBRARY, TK_LIBRARY and TIX_LIBRARY environment variables. Try this: - - env TCL_LIBRARY=/usr/local/lib/tcl8.3 \ - TK_LIBRARY=/usr/local/lib/tk8.3 \ - TIX_LIBRARY=/usr/local/lib/tix8.1 \ - /usr/local/bin/python Demo/tix/tixwidgets.py - - -If you find any bugs or have suggestions for improvement, please report them -via http://tix.sourceforge.net - - diff --git a/Demo/tix/README.txt b/Demo/tix/README.txt deleted file mode 100644 index e0196ac..0000000 --- a/Demo/tix/README.txt +++ /dev/null @@ -1,19 +0,0 @@ -About Tix.py ------------ - -Tix.py is based on an idea of Jean-Marc Lugrin (lugrin@ms.com) who wrote -pytix (another Python-Tix marriage). Tix widgets are an attractive and -useful extension to Tk. See http://tix.sourceforge.net -for more details about Tix and how to get it. - -Features: - 1) It is almost complete. - 2) Tix widgets are represented by classes in Python. Sub-widgets - are members of the mega-widget class. For example, if a - particular TixWidget (e.g. ScrolledText) has an embedded widget - (Text in this case), it is possible to call the methods of the - child directly. - 3) The members of the class are created automatically. In the case - of widgets like ButtonBox, the members are added dynamically. - - diff --git a/Demo/tix/bitmaps/about.xpm b/Demo/tix/bitmaps/about.xpm deleted file mode 100755 index 33ffcc0..0000000 --- a/Demo/tix/bitmaps/about.xpm +++ /dev/null @@ -1,50 +0,0 @@ -/* XPM */ -static char * about_xpm[] = { -"50 40 7 1", -" s None c None", -". c black", -"X c white", -"o c gray70", -"O c navy", -"+ c red", -"@ c yellow", -" ", -" ", -" ", -" ................................. ", -" ..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXoo. ", -" .XooooooooooooooooooooooooooooooXo. ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXooXo. ", -" ..oooooooooooooooooooooooooooooooXo. ", -" ...............................XoXo. ", -" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XoXo. ", -" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XoXo. ", -" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XoXo. ", -" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XoXo. ", -" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XoXo.++++ ", -" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XoXo+++ ", -" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.Xo+++++ ", -" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.Xo++++++ ", -" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.Xo+++ + ", -" .OOOOO@@@@@OOOOOOOOOOOOOOOOOOO.Xo++. ", -" .OOOOOOO@OOOOO@OOOOOOOOOOOOOOO.XoXo. ", -" .OOOOOOO@OOOOOOOOOOOOOOOOOOOOO.XoXo. ", -" .OOOOOOO@OOOO@@OOO@OOO@OOOOOOO.XoXo. ", -" .OOOOOOO@OOOOO@OOOO@O@OOOOOOOO.XoXo. ", -" .OOOOOOO@OOOOO@OOOOO@OOOOOOOOO.XoXo. ", -" .OOOOOOO@OOOOO@OOOOO@OOOOOOOOO.XoXo. ", -" .OOOOOOO@OOOOO@OOOO@O@OOOOOOOO.XoXo. ", -" .OOOOOOO@OOOO@@@OO@OOO@OOOOOOO.XoXo. ", -" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XoXo. ", -" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XoXo. ", -" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XoXo. ", -" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XoXo. ", -" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XoXo. ", -" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XoXo. ", -" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.Xo.. ", -" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.Xo ", -" OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.X. ", -" ............................. ", -" ", -" ", -" "}; diff --git a/Demo/tix/bitmaps/bold.xbm b/Demo/tix/bitmaps/bold.xbm deleted file mode 100755 index ebff8d1..0000000 --- a/Demo/tix/bitmaps/bold.xbm +++ /dev/null @@ -1,6 +0,0 @@ -#define bold_width 16 -#define bold_height 16 -static unsigned char bold_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xfc, 0x0f, 0x18, 0x1c, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x1c, 0xf8, 0x0f, 0xf8, 0x0f, 0x18, 0x18, 0x18, 0x30, - 0x18, 0x30, 0x18, 0x38, 0xfc, 0x3f, 0xfc, 0x1f}; diff --git a/Demo/tix/bitmaps/capital.xbm b/Demo/tix/bitmaps/capital.xbm deleted file mode 100755 index fb4e070..0000000 --- a/Demo/tix/bitmaps/capital.xbm +++ /dev/null @@ -1,6 +0,0 @@ -#define capital_width 16 -#define capital_height 16 -static unsigned char capital_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x08, 0x30, 0x0c, 0x30, 0x06, - 0x30, 0x03, 0xb0, 0x01, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x01, 0xb0, 0x03, - 0x30, 0x07, 0x30, 0x0e, 0x30, 0x1c, 0x00, 0x00}; diff --git a/Demo/tix/bitmaps/centerj.xbm b/Demo/tix/bitmaps/centerj.xbm deleted file mode 100755 index 9d2c064..0000000 --- a/Demo/tix/bitmaps/centerj.xbm +++ /dev/null @@ -1,6 +0,0 @@ -#define centerj_width 16 -#define centerj_height 16 -static unsigned char centerj_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3e, 0x00, 0x00, 0xc0, 0x0d, - 0x00, 0x00, 0x58, 0x77, 0x00, 0x00, 0xb0, 0x3b, 0x00, 0x00, 0xdc, 0xf7, - 0x00, 0x00, 0xf0, 0x3e, 0x00, 0x00, 0xd8, 0x7e}; diff --git a/Demo/tix/bitmaps/combobox.xbm b/Demo/tix/bitmaps/combobox.xbm deleted file mode 100755 index f5947f5..0000000 --- a/Demo/tix/bitmaps/combobox.xbm +++ /dev/null @@ -1,14 +0,0 @@ -#define combobox_width 32 -#define combobox_height 32 -static unsigned char combobox_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xfc, 0xff, 0xff, 0x3e, 0x04, 0x00, 0x80, 0x2a, 0x04, 0x00, 0x80, 0x2a, - 0x04, 0x00, 0x80, 0x2a, 0x04, 0x00, 0x80, 0x2b, 0xfc, 0xff, 0xff, 0x3e, - 0x08, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x3e, 0x08, 0x00, 0x00, 0x2a, - 0x28, 0x49, 0x00, 0x2a, 0x08, 0x00, 0x00, 0x3e, 0x08, 0x00, 0x00, 0x22, - 0x08, 0x00, 0x00, 0x22, 0x28, 0x49, 0x12, 0x22, 0x08, 0x00, 0x00, 0x22, - 0x08, 0x00, 0x00, 0x22, 0x08, 0x00, 0x00, 0x22, 0x28, 0x49, 0x02, 0x22, - 0x08, 0x00, 0x00, 0x3e, 0x08, 0x00, 0x00, 0x2a, 0x08, 0x00, 0x00, 0x2a, - 0xf8, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/Demo/tix/bitmaps/combobox.xpm b/Demo/tix/bitmaps/combobox.xpm deleted file mode 100755 index d0234ab..0000000 --- a/Demo/tix/bitmaps/combobox.xpm +++ /dev/null @@ -1,49 +0,0 @@ -/* XPM */ -static char * combobox_xpm[] = { -"50 40 6 1", -" s None c None", -". c black", -"X c white", -"o c #FFFF80808080", -"O c gray70", -"+ c #808000008080", -" ", -" ", -" ", -" .................................... XXXXXXX ", -" .ooooooooooooooooooooooooooooooooooX X . . ", -" .ooooooooooooooooooooooooooooooooooX X . . ", -" .oooo.oooooooooooooooooooooooooooooX X . . ", -" .oo.o..oo.o.oo.o.ooooooooooooooooooX X . . ", -" .o..o.o.o.oo.oo.oo.ooooooooooooooooX X ... . ", -" .oo.oo.oo.o.oo.ooo.ooooooooooooooooX X . . ", -" .ooooooooooooooooooooooooooooooooooX X . ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X...... ", -" ", -" ", -" ", -" XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ", -" X............................................ ", -" X.OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOX.OOOOX. ", -" X.O+OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOX.OX OX. ", -" X.O++OOO+OO+++OOOOOOOOOOOOOOOOOOOOOOOX.X ..X. ", -" X.O+O+O+OOO+O+OOOOOOOOOOOOOOOOOOOOOOOX.OOOOX. ", -" X.O++OOO+OO+++OOOOOOOOOOOOOOOOOOOOOOOX.OOOOX. ", -" X.OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOX.XXXXX. ", -" X.O.....X..........................OOX.X .X. ", -" X.OX...XXX.X.XX.XX.................OOX.X .X. ", -" X.OX.X..X..X.XX..XX.X..............OOX.X .X. ", -" X.O.X...X..X.X...X..X..............OOX.X .X. ", -" X.OOOOOOOOOOOOOOOOOOOOOOOO+OOOOOOOOOOX.X .X. ", -" X.OOOOOOOOO+OOO+OOOOO+OOOO+OOOOOOOOOOX.X .X. ", -" X.O+++OO+OO+O+OO++O++OO+OO+OOOOOOOOOOX.X...X. ", -" X.OO+OO++OO+O+OO+OOO+OO+O++OOOOOOOOOOX.OOOOX. ", -" X.OOOOOOOO+OOOOO++OO+OOOOOOOOOOOOOOOOX.OOOOX. ", -" X.OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOX.X .X. ", -" X.OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOX.O .OX. ", -" X.OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOX.OOOOX. ", -" X.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.XXXXX. ", -" X............................................ ", -" ", -" ", -" "}; diff --git a/Demo/tix/bitmaps/combobox.xpm.1 b/Demo/tix/bitmaps/combobox.xpm.1 deleted file mode 100755 index 63792a4..0000000 --- a/Demo/tix/bitmaps/combobox.xpm.1 +++ /dev/null @@ -1,47 +0,0 @@ -/* XPM */ -static char * combobox_xpm[] = { -"50 40 4 1", -" s None c None", -". c black", -"X c #FFFF80808080", -"o c gray70", -" ", -" ", -" ", -" .................................... ....... ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX. . . . ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX. . . . ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX. . . . ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX. . . . ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX. . ... . ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX. . . . ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX. . . ", -" .................................... ....... ", -" ", -" ............................................. ", -" .ooooooooooooooooooooooooooooooooooooo.ooooo. ", -" .ooooooooooooooooooooooooooooooooooooo.ooooo. ", -" .o...................................o.ooooo. ", -" .o...................................o.ooooo. ", -" .o...................................o.ooooo. ", -" .o...................................o.ooooo. ", -" .ooooooooooooooooooooooooooooooooooooo.ooooo. ", -" .ooooooooooooooooooooooooooooooooooooo.ooooo. ", -" .ooooooooooooooooooooooooooooooooooooo.ooooo. ", -" .ooooooooooooooooooooooooooooooooooooo.ooooo. ", -" .ooooooooooooooooooooooooooooooooooooo.ooooo. ", -" .ooooooooooooooooooooooooooooooooooooo.ooooo. ", -" .ooooooooooooooooooooooooooooooooooooo.ooooo. ", -" .ooooooooooooooooooooooooooooooooooooo.ooooo. ", -" .ooooooooooooooooooooooooooooooooooooo.ooooo. ", -" .ooooooooooooooooooooooooooooooooooooo.ooooo. ", -" .ooooooooooooooooooooooooooooooooooooo.ooooo. ", -" .ooooooooooooooooooooooooooooooooooooo.ooooo. ", -" .ooooooooooooooooooooooooooooooooooooo.ooooo. ", -" .ooooooooooooooooooooooooooooooooooooo.ooooo. ", -" ............................................. ", -" ", -" ", -" ", -" ", -" "}; diff --git a/Demo/tix/bitmaps/drivea.xbm b/Demo/tix/bitmaps/drivea.xbm deleted file mode 100755 index 83c636c..0000000 --- a/Demo/tix/bitmaps/drivea.xbm +++ /dev/null @@ -1,14 +0,0 @@ -#define drivea_width 32 -#define drivea_height 32 -static unsigned char drivea_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf8, 0xff, 0xff, 0x1f, 0x08, 0x00, 0x00, 0x18, 0xa8, 0xaa, 0xaa, 0x1a, - 0x48, 0x55, 0xd5, 0x1d, 0xa8, 0xaa, 0xaa, 0x1b, 0x48, 0x55, 0x55, 0x1d, - 0xa8, 0xfa, 0xaf, 0x1a, 0xc8, 0xff, 0xff, 0x1d, 0xa8, 0xfa, 0xaf, 0x1a, - 0x48, 0x55, 0x55, 0x1d, 0xa8, 0xaa, 0xaa, 0x1a, 0x48, 0x55, 0x55, 0x1d, - 0xa8, 0xaa, 0xaa, 0x1a, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/Demo/tix/bitmaps/drivea.xpm b/Demo/tix/bitmaps/drivea.xpm deleted file mode 100755 index 4d274b9..0000000 --- a/Demo/tix/bitmaps/drivea.xpm +++ /dev/null @@ -1,43 +0,0 @@ -/* XPM */ -static char * drivea_xpm[] = { -/* width height ncolors chars_per_pixel */ -"32 32 5 1", -/* colors */ -" s None c None", -". c #000000000000", -"X c white", -"o c #c000c000c000", -"O c #800080008000", -/* pixels */ -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" .......................... ", -" .XXXXXXXXXXXXXXXXXXXXXXXo. ", -" .XooooooooooooooooooooooO. ", -" .Xooooooooooooooooo..oooO. ", -" .Xooooooooooooooooo..oooO. ", -" .XooooooooooooooooooooooO. ", -" .Xoooooooo.......oooooooO. ", -" .Xoo...................oO. ", -" .Xoooooooo.......oooooooO. ", -" .XooooooooooooooooooooooO. ", -" .XooooooooooooooooooooooO. ", -" .XooooooooooooooooooooooO. ", -" .XooooooooooooooooooooooO. ", -" .oOOOOOOOOOOOOOOOOOOOOOOO. ", -" .......................... ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/Demo/tix/bitmaps/exit.xpm b/Demo/tix/bitmaps/exit.xpm deleted file mode 100755 index 505a07b..0000000 --- a/Demo/tix/bitmaps/exit.xpm +++ /dev/null @@ -1,48 +0,0 @@ -/* XPM */ -static char * exit_xpm[] = { -"50 40 5 1", -" s None c None", -". c black", -"X c white", -"o c #000080800000", -"O c yellow", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ....................................... ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX. ", -" .XoooooooooooooooooooooooooooooooooooX. ", -" .XoooooooooooooooooooooooooooooooooooX. ", -" .XoooooooooooooooooooooooOoooooooooooX. ", -" .XoooooooooooooooooooooooOOooooooooooX. ", -" .XoooooooooooooooooooooooOOOoooooooooX. ", -" .XoooooOOOOOOOOOOOOOOOOOOOOOOooooooooX. ", -" .XoooooOOOOOOOOOOOOOOOOOOOOOOOoooooooX. ", -" .XoooooOOOOOOOOOOOOOOOOOOOOOOOOooooooX. ", -" .XoooooOOOOOOOOOOOOOOOOOOOOOOOOOoooooX. ", -" .XoooooOOOOOOOOOOOOOOOOOOOOOOOOooooooX. ", -" .XoooooOOOOOOOOOOOOOOOOOOOOOOOoooooooX. ", -" .XoooooOOOOOOOOOOOOOOOOOOOOOOooooooooX. ", -" .XoooooooooooooooooooooooOOOoooooooooX. ", -" .XoooooooooooooooooooooooOOooooooooooX. ", -" .XoooooooooooooooooooooooOoooooooooooX. ", -" .XoooooooooooooooooooooooooooooooooooX. ", -" .XoooooooooooooooooooooooooooooooooooX. ", -" .XoooooooooooooooooooooooooooooooooooX. ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX. ", -" ....................................... ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/Demo/tix/bitmaps/filebox.xbm b/Demo/tix/bitmaps/filebox.xbm deleted file mode 100755 index c8f7ac2..0000000 --- a/Demo/tix/bitmaps/filebox.xbm +++ /dev/null @@ -1,14 +0,0 @@ -#define filebox_width 32 -#define filebox_height 32 -static unsigned char filebox_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x3f, 0x04, 0x00, 0x00, 0x20, - 0xe4, 0xff, 0xff, 0x27, 0x24, 0x00, 0x00, 0x24, 0x24, 0x00, 0x00, 0x24, - 0xe4, 0xff, 0xff, 0x27, 0x04, 0x00, 0x00, 0x20, 0xe4, 0x7f, 0xfe, 0x27, - 0x24, 0x50, 0x02, 0x25, 0x24, 0x40, 0x02, 0x24, 0x24, 0x50, 0x02, 0x25, - 0x24, 0x40, 0x02, 0x24, 0x24, 0x50, 0x02, 0x25, 0x24, 0x40, 0x02, 0x24, - 0x24, 0x50, 0x02, 0x25, 0xe4, 0x7f, 0xfe, 0x27, 0x04, 0x00, 0x00, 0x20, - 0xe4, 0xff, 0xff, 0x27, 0x24, 0x00, 0x00, 0x24, 0x24, 0x00, 0x00, 0x24, - 0xe4, 0xff, 0xff, 0x27, 0x04, 0x00, 0x00, 0x20, 0xfc, 0xff, 0xff, 0x3f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/Demo/tix/bitmaps/filebox.xpm b/Demo/tix/bitmaps/filebox.xpm deleted file mode 100755 index 7377ee6..0000000 --- a/Demo/tix/bitmaps/filebox.xpm +++ /dev/null @@ -1,49 +0,0 @@ -/* XPM */ -static char * filebox_xpm[] = { -"50 40 6 1", -" s None c None", -". c white", -"X c gray80", -"o c black", -"O c #FFFF80808080", -"+ c gray70", -" ", -" ", -" ", -" ............................................ ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo ", -" .XXooXooXoXooXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo ", -" .XXooXooXoXooXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo ", -" .XXooooooooooooooooooooooooooooooooooooo.XXo ", -" .XXoOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XXo ", -" .XXoOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XXo ", -" .XX......................................XXo ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo ", -" .XXoooooooooooooooo.XXXXoooooooooooooooo.XXo ", -" .XXo+++++++++++++++.XXXXo+++++++++++++++.XXo ", -" .XXo+++++++++++++++.XXXXo+++++++++++++++.XXo ", -" .XXo+++++++++++++++.XXXXo+++++++++++++++.XXo ", -" .XXo+++++++++++++++.XXXXo+++++++++++++++.XXo ", -" .XXo+++++++++++++++.XXXXo+++++++++++++++.XXo ", -" .XXo+++++++++++++++.XXXXo+++++++++++++++.XXo ", -" .XXo+++++++++++++++.XXXXo+++++++++++++++.XXo ", -" .XXo+++++++++++++++.XXXXo+++++++++++++++.XXo ", -" .XXo+++++++++++++++.XXXXo+++++++++++++++.XXo ", -" .XXo+++++++++++++++.XXXXo+++++++++++++++.XXo ", -" .XXo+++++++++++++++.XXXXo+++++++++++++++.XXo ", -" .XX.................XXXX.................XXo ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo ", -" .XXooXooXoXooXoXXXXXXXXXXXXXXXXXXXXXXXXXXXXo ", -" .XXooXooXoXooXoXooXXXXXXXXXXXXXXXXXXXXXXXXXo ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo ", -" .XXoooooooooooooooooooooooooooooooooooooo.Xo ", -" .XXoOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.Xo ", -" .XXoOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.Xo ", -" .XX.......................................Xo ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo ", -" .ooooooooooooooooooooooooooooooooooooooooooo ", -" ", -" ", -" "}; diff --git a/Demo/tix/bitmaps/italic.xbm b/Demo/tix/bitmaps/italic.xbm deleted file mode 100755 index 169c3cb..0000000 --- a/Demo/tix/bitmaps/italic.xbm +++ /dev/null @@ -1,6 +0,0 @@ -#define italic_width 16 -#define italic_height 16 -static unsigned char italic_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x80, 0x3f, 0x00, 0x06, 0x00, 0x06, - 0x00, 0x03, 0x00, 0x03, 0x80, 0x01, 0x80, 0x01, 0xc0, 0x00, 0xc0, 0x00, - 0x60, 0x00, 0x60, 0x00, 0xfc, 0x01, 0xfc, 0x01}; diff --git a/Demo/tix/bitmaps/justify.xbm b/Demo/tix/bitmaps/justify.xbm deleted file mode 100755 index bba660a..0000000 --- a/Demo/tix/bitmaps/justify.xbm +++ /dev/null @@ -1,6 +0,0 @@ -#define justify_width 16 -#define justify_height 16 -static unsigned char justify_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xdb, 0x00, 0x00, 0x7c, 0xdb, - 0x00, 0x00, 0xbc, 0xf7, 0x00, 0x00, 0xdc, 0xde, 0x00, 0x00, 0x6c, 0xdf, - 0x00, 0x00, 0x6c, 0xef, 0x00, 0x00, 0xdc, 0xdf}; diff --git a/Demo/tix/bitmaps/leftj.xbm b/Demo/tix/bitmaps/leftj.xbm deleted file mode 100755 index 5f8e006..0000000 --- a/Demo/tix/bitmaps/leftj.xbm +++ /dev/null @@ -1,6 +0,0 @@ -#define leftj_width 16 -#define leftj_height 16 -static unsigned char leftj_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x6d, 0x00, 0x00, 0xdc, 0x01, - 0x00, 0x00, 0xec, 0x0e, 0x00, 0x00, 0xfc, 0x7e, 0x00, 0x00, 0xdc, 0x03, - 0x00, 0x00, 0x6c, 0x3b, 0x00, 0x00, 0x6c, 0x1f}; diff --git a/Demo/tix/bitmaps/netw.xbm b/Demo/tix/bitmaps/netw.xbm deleted file mode 100755 index a684d65..0000000 --- a/Demo/tix/bitmaps/netw.xbm +++ /dev/null @@ -1,14 +0,0 @@ -#define netw_width 32 -#define netw_height 32 -static unsigned char netw_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00, 0x02, 0x40, - 0x00, 0x00, 0xfa, 0x5f, 0x00, 0x00, 0x0a, 0x50, 0x00, 0x00, 0x0a, 0x52, - 0x00, 0x00, 0x0a, 0x52, 0x00, 0x00, 0x8a, 0x51, 0x00, 0x00, 0x0a, 0x50, - 0x00, 0x00, 0x4a, 0x50, 0x00, 0x00, 0x0a, 0x50, 0x00, 0x00, 0x0a, 0x50, - 0x00, 0x00, 0xfa, 0x5f, 0x00, 0x00, 0x02, 0x40, 0xfe, 0x7f, 0x52, 0x55, - 0x02, 0x40, 0xaa, 0x6a, 0xfa, 0x5f, 0xfe, 0x7f, 0x0a, 0x50, 0xfe, 0x7f, - 0x0a, 0x52, 0x80, 0x00, 0x0a, 0x52, 0x80, 0x00, 0x8a, 0x51, 0x80, 0x00, - 0x0a, 0x50, 0x80, 0x00, 0x4a, 0x50, 0x80, 0x00, 0x0a, 0x50, 0xe0, 0x03, - 0x0a, 0x50, 0x20, 0x02, 0xfa, 0xdf, 0x3f, 0x03, 0x02, 0x40, 0xa0, 0x02, - 0x52, 0x55, 0xe0, 0x03, 0xaa, 0x6a, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00, - 0xfe, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/Demo/tix/bitmaps/netw.xpm b/Demo/tix/bitmaps/netw.xpm deleted file mode 100755 index fff6593..0000000 --- a/Demo/tix/bitmaps/netw.xpm +++ /dev/null @@ -1,45 +0,0 @@ -/* XPM */ -static char * netw_xpm[] = { -/* width height ncolors chars_per_pixel */ -"32 32 7 1", -/* colors */ -" s None c None", -". c #000000000000", -"X c white", -"o c #c000c000c000", -"O c #404040", -"+ c blue", -"@ c red", -/* pixels */ -" ", -" .............. ", -" .XXXXXXXXXXXX. ", -" .XooooooooooO. ", -" .Xo.......XoO. ", -" .Xo.++++o+XoO. ", -" .Xo.++++o+XoO. ", -" .Xo.++oo++XoO. ", -" .Xo.++++++XoO. ", -" .Xo.+o++++XoO. ", -" .Xo.++++++XoO. ", -" .Xo.XXXXXXXoO. ", -" .XooooooooooO. ", -" .Xo@ooo....oO. ", -" .............. .XooooooooooO. ", -" .XXXXXXXXXXXX. .XooooooooooO. ", -" .XooooooooooO. .OOOOOOOOOOOO. ", -" .Xo.......XoO. .............. ", -" .Xo.++++o+XoO. @ ", -" .Xo.++++o+XoO. @ ", -" .Xo.++oo++XoO. @ ", -" .Xo.++++++XoO. @ ", -" .Xo.+o++++XoO. @ ", -" .Xo.++++++XoO. ..... ", -" .Xo.XXXXXXXoO. .XXX. ", -" .XooooooooooO.@@@@@@.X O. ", -" .Xo@ooo....oO. .OOO. ", -" .XooooooooooO. ..... ", -" .XooooooooooO. ", -" .OOOOOOOOOOOO. ", -" .............. ", -" "}; diff --git a/Demo/tix/bitmaps/optmenu.xpm b/Demo/tix/bitmaps/optmenu.xpm deleted file mode 100755 index 63bab81..0000000 --- a/Demo/tix/bitmaps/optmenu.xpm +++ /dev/null @@ -1,48 +0,0 @@ -/* XPM */ -static char * optmenu_xpm[] = { -"50 40 5 1", -" s None c None", -". c white", -"X c gray80", -"o c gray50", -"O c black", -" ", -" ", -" .............................. ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXo ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXo ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXo ", -" .XXXOXOXXOXXOXXXXOOXXXXXXXXXXo ", -" .XXXOXOXXOXOXXXOXXOXXXXXXXXXXo ", -" .XXXXOXXOXXOXXXOXXXOXXXXXXXXXo ", -" .XXXXOXXXOXXOOXXOXOXXXXXXXXXXo ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXo ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXo.............o ", -" .............................o o ", -" ..XXXOXXXXXOXXXXXXXXOXXXXXXXOo o ", -" ..XXOXOXOXXOXOXXXOXXOXXXXXXXOo ...... o ", -" ..XXXOXXXOXXOXXXOXXXOXXXXXXXOo . o o ", -" ..XXOXXXOXXXOXOXXOXXOXXXXXXXOo . o o ", -" ..XXXXXXXXXXXXXXXXXXXXXXXXXXOo .ooooo o ", -" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOo o ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXo o ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXooooooooooooooo ", -" .XXXXOXXXXXOXXXXXXXXXXXXXXXXXo ", -" .XXXOXXXXXXXXXOXXXXXXXXXXXXXXo ", -" .XXXXOXXOXXOXOXOXXXXXXXXXXXXXo ", -" .XXXXXOXXOXOXXXXXXXXXXXXXXXXXo ", -" .XXXXXXXXXXXXXOXXXXXXXXXXXXXXo ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXo ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXo ", -" .XXXOXOXXXXXXXOXOXXXXXOXXXXXXo ", -" .XXXXXOXOXOXXOXXXXXOXXOXXXXXXo ", -" .XXXXOXXOXOXOXXXOXOXOXXOXXXXXo ", -" .XXXOXXXXOXXOXXXOXXOXXXXOXXXXo ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXo ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXo ", -" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXo ", -" oooooooooooooooooooooooooooooo ", -" ", -" ", -" ", -" "}; diff --git a/Demo/tix/bitmaps/rightj.xbm b/Demo/tix/bitmaps/rightj.xbm deleted file mode 100755 index 1d438e0..0000000 --- a/Demo/tix/bitmaps/rightj.xbm +++ /dev/null @@ -1,6 +0,0 @@ -#define rightj_width 16 -#define rightj_height 16 -static unsigned char rightj_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xdb, 0x00, 0x00, 0x70, 0xdb, - 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0xd8, 0xde, 0x00, 0x00, 0xc0, 0xdd, - 0x00, 0x00, 0xa0, 0xef, 0x00, 0x00, 0xd8, 0xde}; diff --git a/Demo/tix/bitmaps/select.xpm b/Demo/tix/bitmaps/select.xpm deleted file mode 100755 index 392e5a0..0000000 --- a/Demo/tix/bitmaps/select.xpm +++ /dev/null @@ -1,52 +0,0 @@ -/* XPM */ -static char * select_xpm[] = { -"50 40 9 1", -" s None c None", -". c black", -"X c gray95", -"o c gray50", -"O c gray70", -"+ c navy", -"@ c #000080800000", -"# c #808000000000", -"$ c white", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" .............................................. ", -" .XXXXXXXXXXooooooooooooXXXXXXXXXXXoXXXXXXXXXX. ", -" .X ooOOOOOOOOOOXX oX o. ", -" .X ooOOOOOOOOOOXX oX o. ", -" .X ++++ ooOOOOOOOOOOXX ... oX @ o. ", -" .X +++++ ooOOOOOOOOOOXX . . oX @@@ o. ", -" .X +++ + ooOOOOOOOOOOXX . . oX @ @ o. ", -" .X + + ooOO#####OOOXX . . oX @ @ o. ", -" .X + + ooOO#OOO##OOXX . oX @ @ o. ", -" .X + + ooO##OOOO##OXX . oX @ @ o. ", -" .X ++ ++ ooO###OOO#OOXX . oX @ @ o. ", -" .X +++++++ ooO#######OOXX . oX @ @ o. ", -" .X + + ooO##O#OO#OOXX . oX @ @ o. ", -" .X + ++ ooO##OOOOO#OXX . . oX @ @ o. ", -" .X + + ooOO#OOOOO#OXX . . oX @ @@ o. ", -" .X + ++ ooOO#OOOOO#OXX .... oX @@@@@ o. ", -" .X ooOO######OOXX oX o. ", -" .X ooOOOOOOOOOOXX $oX o. ", -" .XoooooooooooXXXXXXXXXXXoooooooooooXooooooooo. ", -" .............................................. ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/Demo/tix/bitmaps/tix.gif b/Demo/tix/bitmaps/tix.gif Binary files differdeleted file mode 100755 index e7d51a0..0000000 --- a/Demo/tix/bitmaps/tix.gif +++ /dev/null diff --git a/Demo/tix/bitmaps/underline.xbm b/Demo/tix/bitmaps/underline.xbm deleted file mode 100755 index f07bb46..0000000 --- a/Demo/tix/bitmaps/underline.xbm +++ /dev/null @@ -1,6 +0,0 @@ -#define underline_width 16 -#define underline_height 16 -static unsigned char underline_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x1c, 0x38, 0x1c, - 0x30, 0x0c, 0x30, 0x0c, 0x30, 0x0c, 0x30, 0x0c, 0x30, 0x0c, 0x70, 0x0e, - 0xf0, 0x0f, 0xe0, 0x07, 0x00, 0x00, 0xf8, 0x1f}; diff --git a/Demo/tix/grid.py b/Demo/tix/grid.py deleted file mode 100644 index 4268f07..0000000 --- a/Demo/tix/grid.py +++ /dev/null @@ -1,28 +0,0 @@ -### -import tkinter.tix as tk -from pprint import pprint - -r= tk.Tk() -r.title("test") - -l=tk.Label(r, name="a_label") -l.pack() - -class MyGrid(tk.Grid): - def __init__(self, *args, **kwargs): - kwargs['editnotify']= self.editnotify - tk.Grid.__init__(self, *args, **kwargs) - def editnotify(self, x, y): - return True - -g = MyGrid(r, name="a_grid", -selectunit="cell") -g.pack(fill=tk.BOTH) -for x in range(5): - for y in range(5): - g.set(x,y,text=str((x,y))) - -c = tk.Button(r, text="Close", command=r.destroy) -c.pack() - -tk.mainloop() diff --git a/Demo/tix/samples/Balloon.py b/Demo/tix/samples/Balloon.py deleted file mode 100644 index bc25a2e..0000000 --- a/Demo/tix/samples/Balloon.py +++ /dev/null @@ -1,68 +0,0 @@ -# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- -# -# $Id$ -# -# Tix Demostration Program -# -# This sample program is structured in such a way so that it can be -# executed from the Tix demo program "tixwidgets.py": it must have a -# procedure called "RunSample". It should also have the "if" statment -# at the end of this file so that it can be run as a standalone -# program. - -# This file demonstrates the use of the tixBalloon widget, which provides -# a interesting way to give help tips about elements in your user interface. -# Your can display the help message in a "balloon" and a status bar widget. -# - -import tkinter.tix - -TCL_ALL_EVENTS = 0 - -def RunSample (root): - balloon = DemoBalloon(root) - balloon.mainloop() - balloon.destroy() - -class DemoBalloon: - def __init__(self, w): - self.root = w - self.exit = -1 - - z = w.winfo_toplevel() - z.wm_protocol("WM_DELETE_WINDOW", lambda self=self: self.quitcmd()) - - status = tkinter.tix.Label(w, width=40, relief=tkinter.tix.SUNKEN, bd=1) - status.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.Y, padx=2, pady=1) - - # Create two mysterious widgets that need balloon help - button1 = tkinter.tix.Button(w, text='Something Unexpected', - command=self.quitcmd) - button2 = tkinter.tix.Button(w, text='Something Else Unexpected') - button2['command'] = lambda w=button2: w.destroy() - button1.pack(side=tkinter.tix.TOP, expand=1) - button2.pack(side=tkinter.tix.TOP, expand=1) - - # Create the balloon widget and associate it with the widgets that we want - # to provide tips for: - b = tkinter.tix.Balloon(w, statusbar=status) - - b.bind_widget(button1, balloonmsg='Close Window', - statusmsg='Press this button to close this window') - b.bind_widget(button2, balloonmsg='Self-destruct button', - statusmsg='Press this button and it will destroy itself') - - def quitcmd (self): - self.exit = 0 - - def mainloop(self): - foundEvent = 1 - while self.exit < 0 and foundEvent > 0: - foundEvent = self.root.tk.dooneevent(TCL_ALL_EVENTS) - - def destroy (self): - self.root.destroy() - -if __name__ == '__main__': - root = tkinter.tix.Tk() - RunSample(root) diff --git a/Demo/tix/samples/BtnBox.py b/Demo/tix/samples/BtnBox.py deleted file mode 100644 index 3b9ee4b..0000000 --- a/Demo/tix/samples/BtnBox.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- -# -# $Id$ -# -# Tix Demostration Program -# -# This sample program is structured in such a way so that it can be -# executed from the Tix demo program "tixwidgets.py": it must have a -# procedure called "RunSample". It should also have the "if" statment -# at the end of this file so that it can be run as a standalone -# program. - -# This file demonstrates the use of the tixButtonBox widget, which is a -# group of TK buttons. You can use it to manage the buttons in a dialog box, -# for example. -# - -import tkinter.tix - -def RunSample(w): - # Create the label on the top of the dialog box - # - top = tkinter.tix.Label(w, padx=20, pady=10, bd=1, relief=tkinter.tix.RAISED, - anchor=tkinter.tix.CENTER, text='This dialog box is\n a demonstration of the\n tixButtonBox widget') - - # Create the button box and add a few buttons in it. Set the - # -width of all the buttons to the same value so that they - # appear in the same size. - # - # Note that the -text, -underline, -command and -width options are all - # standard options of the button widgets. - # - box = tkinter.tix.ButtonBox(w, orientation=tkinter.tix.HORIZONTAL) - box.add('ok', text='OK', underline=0, width=5, - command=lambda w=w: w.destroy()) - box.add('close', text='Cancel', underline=0, width=5, - command=lambda w=w: w.destroy()) - box.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.X) - top.pack(side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1) - -if __name__ == '__main__': - root = tkinter.tix.Tk() - RunSample(root) - root.mainloop() diff --git a/Demo/tix/samples/CmpImg.py b/Demo/tix/samples/CmpImg.py deleted file mode 100644 index ad49181..0000000 --- a/Demo/tix/samples/CmpImg.py +++ /dev/null @@ -1,196 +0,0 @@ -# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- -# -# $Id$ -# -# Tix Demostration Program -# -# This sample program is structured in such a way so that it can be -# executed from the Tix demo program "tixwidgets.py": it must have a -# procedure called "RunSample". It should also have the "if" statment -# at the end of this file so that it can be run as a standalone -# program. - -# This file demonstrates the use of the compound images: it uses compound -# images to display a text string together with a pixmap inside -# buttons -# - -import tkinter.tix - -network_pixmap = """/* XPM */ -static char * netw_xpm[] = { -/* width height ncolors chars_per_pixel */ -"32 32 7 1", -/* colors */ -" s None c None", -". c #000000000000", -"X c white", -"o c #c000c000c000", -"O c #404040", -"+ c blue", -"@ c red", -/* pixels */ -" ", -" .............. ", -" .XXXXXXXXXXXX. ", -" .XooooooooooO. ", -" .Xo.......XoO. ", -" .Xo.++++o+XoO. ", -" .Xo.++++o+XoO. ", -" .Xo.++oo++XoO. ", -" .Xo.++++++XoO. ", -" .Xo.+o++++XoO. ", -" .Xo.++++++XoO. ", -" .Xo.XXXXXXXoO. ", -" .XooooooooooO. ", -" .Xo@ooo....oO. ", -" .............. .XooooooooooO. ", -" .XXXXXXXXXXXX. .XooooooooooO. ", -" .XooooooooooO. .OOOOOOOOOOOO. ", -" .Xo.......XoO. .............. ", -" .Xo.++++o+XoO. @ ", -" .Xo.++++o+XoO. @ ", -" .Xo.++oo++XoO. @ ", -" .Xo.++++++XoO. @ ", -" .Xo.+o++++XoO. @ ", -" .Xo.++++++XoO. ..... ", -" .Xo.XXXXXXXoO. .XXX. ", -" .XooooooooooO.@@@@@@.X O. ", -" .Xo@ooo....oO. .OOO. ", -" .XooooooooooO. ..... ", -" .XooooooooooO. ", -" .OOOOOOOOOOOO. ", -" .............. ", -" "}; -""" - -hard_disk_pixmap = """/* XPM */ -static char * drivea_xpm[] = { -/* width height ncolors chars_per_pixel */ -"32 32 5 1", -/* colors */ -" s None c None", -". c #000000000000", -"X c white", -"o c #c000c000c000", -"O c #800080008000", -/* pixels */ -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" .......................... ", -" .XXXXXXXXXXXXXXXXXXXXXXXo. ", -" .XooooooooooooooooooooooO. ", -" .Xooooooooooooooooo..oooO. ", -" .Xooooooooooooooooo..oooO. ", -" .XooooooooooooooooooooooO. ", -" .Xoooooooo.......oooooooO. ", -" .Xoo...................oO. ", -" .Xoooooooo.......oooooooO. ", -" .XooooooooooooooooooooooO. ", -" .XooooooooooooooooooooooO. ", -" .XooooooooooooooooooooooO. ", -" .XooooooooooooooooooooooO. ", -" .oOOOOOOOOOOOOOOOOOOOOOOO. ", -" .......................... ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; -""" - -network_bitmap = """ -#define netw_width 32 -#define netw_height 32 -static unsigned char netw_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00, 0x02, 0x40, - 0x00, 0x00, 0xfa, 0x5f, 0x00, 0x00, 0x0a, 0x50, 0x00, 0x00, 0x0a, 0x52, - 0x00, 0x00, 0x0a, 0x52, 0x00, 0x00, 0x8a, 0x51, 0x00, 0x00, 0x0a, 0x50, - 0x00, 0x00, 0x4a, 0x50, 0x00, 0x00, 0x0a, 0x50, 0x00, 0x00, 0x0a, 0x50, - 0x00, 0x00, 0xfa, 0x5f, 0x00, 0x00, 0x02, 0x40, 0xfe, 0x7f, 0x52, 0x55, - 0x02, 0x40, 0xaa, 0x6a, 0xfa, 0x5f, 0xfe, 0x7f, 0x0a, 0x50, 0xfe, 0x7f, - 0x0a, 0x52, 0x80, 0x00, 0x0a, 0x52, 0x80, 0x00, 0x8a, 0x51, 0x80, 0x00, - 0x0a, 0x50, 0x80, 0x00, 0x4a, 0x50, 0x80, 0x00, 0x0a, 0x50, 0xe0, 0x03, - 0x0a, 0x50, 0x20, 0x02, 0xfa, 0xdf, 0x3f, 0x03, 0x02, 0x40, 0xa0, 0x02, - 0x52, 0x55, 0xe0, 0x03, 0xaa, 0x6a, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00, - 0xfe, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -""" - -hard_disk_bitmap = """ -#define drivea_width 32 -#define drivea_height 32 -static unsigned char drivea_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf8, 0xff, 0xff, 0x1f, 0x08, 0x00, 0x00, 0x18, 0xa8, 0xaa, 0xaa, 0x1a, - 0x48, 0x55, 0xd5, 0x1d, 0xa8, 0xaa, 0xaa, 0x1b, 0x48, 0x55, 0x55, 0x1d, - 0xa8, 0xfa, 0xaf, 0x1a, 0xc8, 0xff, 0xff, 0x1d, 0xa8, 0xfa, 0xaf, 0x1a, - 0x48, 0x55, 0x55, 0x1d, 0xa8, 0xaa, 0xaa, 0x1a, 0x48, 0x55, 0x55, 0x1d, - 0xa8, 0xaa, 0xaa, 0x1a, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -""" - -def RunSample(w): - w.img0 = tkinter.tix.Image('pixmap', data=network_pixmap) - if not w.img0: - w.img0 = tkinter.tix.Image('bitmap', data=network_bitmap) - w.img1 = tkinter.tix.Image('pixmap', data=hard_disk_pixmap) - if not w.img0: - w.img1 = tkinter.tix.Image('bitmap', data=hard_disk_bitmap) - - hdd = tkinter.tix.Button(w, padx=4, pady=1, width=120) - net = tkinter.tix.Button(w, padx=4, pady=1, width=120) - - # Create the first image: we create a line, then put a string, - # a space and a image into this line, from left to right. - # The result: we have a one-line image that consists of three - # individual items - # - # The tk.calls should be methods in Tix ... - w.hdd_img = tkinter.tix.Image('compound', window=hdd) - w.hdd_img.tk.call(str(w.hdd_img), 'add', 'line') - w.hdd_img.tk.call(str(w.hdd_img), 'add', 'text', '-text', 'Hard Disk', - '-underline', '0') - w.hdd_img.tk.call(str(w.hdd_img), 'add', 'space', '-width', '7') - w.hdd_img.tk.call(str(w.hdd_img), 'add', 'image', '-image', w.img1) - - # Put this image into the first button - # - hdd['image'] = w.hdd_img - - # Next button - w.net_img = tkinter.tix.Image('compound', window=net) - w.net_img.tk.call(str(w.net_img), 'add', 'line') - w.net_img.tk.call(str(w.net_img), 'add', 'text', '-text', 'Network', - '-underline', '0') - w.net_img.tk.call(str(w.net_img), 'add', 'space', '-width', '7') - w.net_img.tk.call(str(w.net_img), 'add', 'image', '-image', w.img0) - - # Put this image into the first button - # - net['image'] = w.net_img - - close = tkinter.tix.Button(w, pady=1, text='Close', - command=lambda w=w: w.destroy()) - - hdd.pack(side=tkinter.tix.LEFT, padx=10, pady=10, fill=tkinter.tix.Y, expand=1) - net.pack(side=tkinter.tix.LEFT, padx=10, pady=10, fill=tkinter.tix.Y, expand=1) - close.pack(side=tkinter.tix.LEFT, padx=10, pady=10, fill=tkinter.tix.Y, expand=1) - -if __name__ == '__main__': - root = tkinter.tix.Tk() - RunSample(root) - root.mainloop() diff --git a/Demo/tix/samples/ComboBox.py b/Demo/tix/samples/ComboBox.py deleted file mode 100644 index 80d78f2..0000000 --- a/Demo/tix/samples/ComboBox.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- -# -# $Id$ -# -# Tix Demostration Program -# -# This sample program is structured in such a way so that it can be -# executed from the Tix demo program "tixwidgets.py": it must have a -# procedure called "RunSample". It should also have the "if" statment -# at the end of this file so that it can be run as a standalone -# program. - -# This file demonstrates the use of the tixComboBox widget, which is close -# to the MS Window Combo Box control. -# -import tkinter.tix - -def RunSample(w): - global demo_month, demo_year - - top = tkinter.tix.Frame(w, bd=1, relief=tkinter.tix.RAISED) - - demo_month = tkinter.tix.StringVar() - demo_year = tkinter.tix.StringVar() - - # $w.top.a is a drop-down combo box. It is not editable -- who wants - # to invent new months? - # - # [Hint] The -options switch sets the options of the subwidgets. - # [Hint] We set the label.width subwidget option of both comboboxes to - # be 10 so that their labels appear to be aligned. - # - a = tkinter.tix.ComboBox(top, label="Month: ", dropdown=1, - command=select_month, editable=0, variable=demo_month, - options='listbox.height 6 label.width 10 label.anchor e') - - # $w.top.b is a non-drop-down combo box. It is not editable: we provide - # four choices for the user, but he can enter an alternative year if he - # wants to. - # - # [Hint] Use the padY and anchor options of the label subwidget to - # align the label with the entry subwidget. - # [Hint] Notice that you should use padY (the NAME of the option) and not - # pady (the SWITCH of the option). - # - b = tkinter.tix.ComboBox(top, label="Year: ", dropdown=0, - command=select_year, editable=1, variable=demo_year, - options='listbox.height 4 label.padY 5 label.width 10 label.anchor ne') - - a.pack(side=tkinter.tix.TOP, anchor=tkinter.tix.W) - b.pack(side=tkinter.tix.TOP, anchor=tkinter.tix.W) - - a.insert(tkinter.tix.END, 'January') - a.insert(tkinter.tix.END, 'February') - a.insert(tkinter.tix.END, 'March') - a.insert(tkinter.tix.END, 'April') - a.insert(tkinter.tix.END, 'May') - a.insert(tkinter.tix.END, 'June') - a.insert(tkinter.tix.END, 'July') - a.insert(tkinter.tix.END, 'August') - a.insert(tkinter.tix.END, 'September') - a.insert(tkinter.tix.END, 'October') - a.insert(tkinter.tix.END, 'November') - a.insert(tkinter.tix.END, 'December') - - b.insert(tkinter.tix.END, '1992') - b.insert(tkinter.tix.END, '1993') - b.insert(tkinter.tix.END, '1994') - b.insert(tkinter.tix.END, '1995') - b.insert(tkinter.tix.END, '1996') - - # Use "tixSetSilent" to set the values of the combo box if you - # don't want your -command procedures (cbx:select_month and - # cbx:select_year) to be called. - # - a.set_silent('January') - b.set_silent('1995') - - box = tkinter.tix.ButtonBox(w, orientation=tkinter.tix.HORIZONTAL) - box.add('ok', text='Ok', underline=0, width=6, - command=lambda w=w: ok_command(w)) - box.add('cancel', text='Cancel', underline=0, width=6, - command=lambda w=w: w.destroy()) - box.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.X) - top.pack(side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1) - -def select_month(event=None): - # tixDemo:Status "Month = %s" % demo_month.get() - pass - -def select_year(event=None): - # tixDemo:Status "Year = %s" % demo_year.get() - pass - -def ok_command(w): - # tixDemo:Status "Month = %s, Year= %s" % (demo_month.get(), demo_year.get()) - w.destroy() - -if __name__ == '__main__': - root = tkinter.tix.Tk() - RunSample(root) - root.mainloop() diff --git a/Demo/tix/samples/Control.py b/Demo/tix/samples/Control.py deleted file mode 100644 index fbc5e64..0000000 --- a/Demo/tix/samples/Control.py +++ /dev/null @@ -1,122 +0,0 @@ -# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- -# -# $Id$ -# -# Tix Demostration Program -# -# This sample program is structured in such a way so that it can be -# executed from the Tix demo program "tixwidgets.py": it must have a -# procedure called "RunSample". It should also have the "if" statment -# at the end of this file so that it can be run as a standalone -# program. - -# This file demonstrates the use of the tixControl widget -- it is an -# entry widget with up/down arrow buttons. You can use the arrow buttons -# to adjust the value inside the entry widget. -# -# This example program uses three Control widgets. One lets you select -# integer values; one lets you select floating point values and the last -# one lets you select a few names. - -import tkinter.tix - -TCL_ALL_EVENTS = 0 - -def RunSample (root): - control = DemoControl(root) - control.mainloop() - control.destroy() - -class DemoControl: - def __init__(self, w): - self.root = w - self.exit = -1 - - global demo_maker, demo_thrust, demo_num_engines - - demo_maker = tkinter.tix.StringVar() - demo_thrust = tkinter.tix.DoubleVar() - demo_num_engines = tkinter.tix.IntVar() - demo_maker.set('P&W') - demo_thrust.set(20000.0) - demo_num_engines.set(2) - - top = tkinter.tix.Frame(w, bd=1, relief=tkinter.tix.RAISED) - - # $w.top.a allows only integer values - # - # [Hint] The -options switch sets the options of the subwidgets. - # [Hint] We set the label.width subwidget option of the Controls to - # be 16 so that their labels appear to be aligned. - # - a = tkinter.tix.Control(top, label='Number of Engines: ', integer=1, - variable=demo_num_engines, min=1, max=4, - options='entry.width 10 label.width 20 label.anchor e') - - b = tkinter.tix.Control(top, label='Thrust: ', integer=0, - min='10000.0', max='60000.0', step=500, - variable=demo_thrust, - options='entry.width 10 label.width 20 label.anchor e') - - c = tkinter.tix.Control(top, label='Engine Maker: ', value='P&W', - variable=demo_maker, - options='entry.width 10 label.width 20 label.anchor e') - - # We can't define these in the init because the widget 'c' doesn't - # exist yet and we need to reference it - c['incrcmd'] = lambda w=c: adjust_maker(w, 1) - c['decrcmd'] = lambda w=c: adjust_maker(w, -1) - c['validatecmd'] = lambda w=c: validate_maker(w) - - a.pack(side=tkinter.tix.TOP, anchor=tkinter.tix.W) - b.pack(side=tkinter.tix.TOP, anchor=tkinter.tix.W) - c.pack(side=tkinter.tix.TOP, anchor=tkinter.tix.W) - - box = tkinter.tix.ButtonBox(w, orientation=tkinter.tix.HORIZONTAL) - box.add('ok', text='Ok', underline=0, width=6, - command=self.okcmd) - box.add('cancel', text='Cancel', underline=0, width=6, - command=self.quitcmd) - box.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.X) - top.pack(side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1) - - def okcmd (self): - # tixDemo:Status "Selected %d of %s engines each of thrust %d", (demo_num_engines.get(), demo_maker.get(), demo_thrust.get()) - self.quitcmd() - - def quitcmd (self): - self.exit = 0 - - def mainloop(self): - while self.exit < 0: - self.root.tk.dooneevent(TCL_ALL_EVENTS) - - def destroy (self): - self.root.destroy() - -maker_list = ['P&W', 'GE', 'Rolls Royce'] - -def adjust_maker(w, inc): - i = maker_list.index(demo_maker.get()) - i = i + inc - if i >= len(maker_list): - i = 0 - elif i < 0: - i = len(maker_list) - 1 - - # In Tcl/Tix we should return the string maker_list[i]. We can't - # do that in Tkinter so we set the global variable. (This works). - demo_maker.set(maker_list[i]) - -def validate_maker(w): - try: - i = maker_list.index(demo_maker.get()) - except ValueError: - # Works here though. Why ? Beats me. - return maker_list[0] - # Works here though. Why ? Beats me. - return maker_list[i] - -if __name__ == '__main__': - root = tkinter.tix.Tk() - RunSample(root) diff --git a/Demo/tix/samples/DirList.py b/Demo/tix/samples/DirList.py deleted file mode 100644 index 6d28ca3..0000000 --- a/Demo/tix/samples/DirList.py +++ /dev/null @@ -1,131 +0,0 @@ -# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- -# -# $Id$ -# -# Tix Demostration Program -# -# This sample program is structured in such a way so that it can be -# executed from the Tix demo program "tixwidgets.py": it must have a -# procedure called "RunSample". It should also have the "if" statment -# at the end of this file so that it can be run as a standalone -# program using tixwish. - -# This file demonstrates the use of the tixDirList widget -- you can -# use it for the user to select a directory. For example, an installation -# program can use the tixDirList widget to ask the user to select the -# installation directory for an application. -# - -import tkinter.tix, os, copy -from tkinter.constants import * - -TCL_ALL_EVENTS = 0 - -def RunSample (root): - dirlist = DemoDirList(root) - dirlist.mainloop() - dirlist.destroy() - -class DemoDirList: - def __init__(self, w): - self.root = w - self.exit = -1 - - z = w.winfo_toplevel() - z.wm_protocol("WM_DELETE_WINDOW", lambda self=self: self.quitcmd()) - - # Create the tixDirList and the tixLabelEntry widgets on the on the top - # of the dialog box - - # bg = root.tk.eval('tix option get bg') - # adding bg=bg crashes Windows pythonw tk8.3.3 Python 2.1.0 - - top = tkinter.tix.Frame( w, relief=RAISED, bd=1) - - # Create the DirList widget. By default it will show the current - # directory - # - # - top.dir = tkinter.tix.DirList(top) - top.dir.hlist['width'] = 40 - - # When the user presses the ".." button, the selected directory - # is "transferred" into the entry widget - # - top.btn = tkinter.tix.Button(top, text = " >> ", pady = 0) - - # We use a LabelEntry to hold the installation directory. The user - # can choose from the DirList widget, or he can type in the directory - # manually - # - top.ent = tkinter.tix.LabelEntry(top, label="Installation Directory:", - labelside = 'top', - options = ''' - entry.width 40 - label.anchor w - ''') - - font = self.root.tk.eval('tix option get fixed_font') - # font = self.root.master.tix_option_get('fixed_font') - top.ent.entry['font'] = font - - self.dlist_dir = copy.copy(os.curdir) - # This should work setting the entry's textvariable - top.ent.entry['textvariable'] = self.dlist_dir - top.btn['command'] = lambda dir=top.dir, ent=top.ent, self=self: \ - self.copy_name(dir,ent) - - # top.ent.entry.insert(0,'tix'+repr(self)) - top.ent.entry.bind('<Return>', lambda self=self: self.okcmd () ) - - top.pack( expand='yes', fill='both', side=TOP) - top.dir.pack( expand=1, fill=BOTH, padx=4, pady=4, side=LEFT) - top.btn.pack( anchor='s', padx=4, pady=4, side=LEFT) - top.ent.pack( expand=1, fill=X, anchor='s', padx=4, pady=4, side=LEFT) - - # Use a ButtonBox to hold the buttons. - # - box = tkinter.tix.ButtonBox (w, orientation='horizontal') - box.add ('ok', text='Ok', underline=0, width=6, - command = lambda self=self: self.okcmd () ) - box.add ('cancel', text='Cancel', underline=0, width=6, - command = lambda self=self: self.quitcmd () ) - - box.pack( anchor='s', fill='x', side=BOTTOM) - - def copy_name (self, dir, ent): - # This should work as it is the entry's textvariable - self.dlist_dir = dir.cget('value') - # but it isn't so I'll do it manually - ent.entry.delete(0,'end') - ent.entry.insert(0, self.dlist_dir) - - def okcmd (self): - # tixDemo:Status "You have selected the directory" + self.dlist_dir - self.quitcmd() - - def quitcmd (self): - self.exit = 0 - - def mainloop(self): - while self.exit < 0: - self.root.tk.dooneevent(TCL_ALL_EVENTS) - - def destroy (self): - self.root.destroy() - -# This "if" statement makes it possible to run this script file inside or -# outside of the main demo program "tixwidgets.py". -# -if __name__== '__main__' : - import tkinter.messagebox, traceback - - try: - root=tkinter.tix.Tk() - RunSample(root) - except: - t, v, tb = sys.exc_info() - text = "Error running the demo script:\n" - for line in traceback.format_exception(t,v,tb): - text = text + line + '\n' - d = tkinter.messagebox.showerror ( 'Tix Demo Error', text) diff --git a/Demo/tix/samples/DirTree.py b/Demo/tix/samples/DirTree.py deleted file mode 100644 index 5411ded..0000000 --- a/Demo/tix/samples/DirTree.py +++ /dev/null @@ -1,117 +0,0 @@ -# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- -# -# $Id$ -# -# Tix Demostration Program -# -# This sample program is structured in such a way so that it can be -# executed from the Tix demo program "tixwidgets.py": it must have a -# procedure called "RunSample". It should also have the "if" statment -# at the end of this file so that it can be run as a standalone -# program using tixwish. - -# This file demonstrates the use of the tixDirTree widget -- you can -# use it for the user to select a directory. For example, an installation -# program can use the tixDirTree widget to ask the user to select the -# installation directory for an application. -# - -import tkinter.tix, os, copy -from tkinter.constants import * - -TCL_ALL_EVENTS = 0 - -def RunSample (root): - dirtree = DemoDirTree(root) - dirtree.mainloop() - dirtree.destroy() - -class DemoDirTree: - def __init__(self, w): - self.root = w - self.exit = -1 - - z = w.winfo_toplevel() - z.wm_protocol("WM_DELETE_WINDOW", lambda self=self: self.quitcmd()) - - # Create the tixDirTree and the tixLabelEntry widgets on the on the top - # of the dialog box - - # bg = root.tk.eval('tix option get bg') - # adding bg=bg crashes Windows pythonw tk8.3.3 Python 2.1.0 - - top = tkinter.tix.Frame( w, relief=RAISED, bd=1) - - # Create the DirTree widget. By default it will show the current - # directory - # - # - top.dir = tkinter.tix.DirTree(top) - top.dir.hlist['width'] = 40 - - # When the user presses the ".." button, the selected directory - # is "transferred" into the entry widget - # - top.btn = tkinter.tix.Button(top, text = " >> ", pady = 0) - - # We use a LabelEntry to hold the installation directory. The user - # can choose from the DirTree widget, or he can type in the directory - # manually - # - top.ent = tkinter.tix.LabelEntry(top, label="Installation Directory:", - labelside = 'top', - options = ''' - entry.width 40 - label.anchor w - ''') - - self.dlist_dir = copy.copy(os.curdir) - top.ent.entry['textvariable'] = self.dlist_dir - top.btn['command'] = lambda dir=top.dir, ent=top.ent, self=self: \ - self.copy_name(dir,ent) - - top.ent.entry.bind('<Return>', lambda self=self: self.okcmd () ) - - top.pack( expand='yes', fill='both', side=TOP) - top.dir.pack( expand=1, fill=BOTH, padx=4, pady=4, side=LEFT) - top.btn.pack( anchor='s', padx=4, pady=4, side=LEFT) - top.ent.pack( expand=1, fill=X, anchor='s', padx=4, pady=4, side=LEFT) - - # Use a ButtonBox to hold the buttons. - # - box = tkinter.tix.ButtonBox (w, orientation='horizontal') - box.add ('ok', text='Ok', underline=0, width=6, - command = lambda self=self: self.okcmd () ) - box.add ('cancel', text='Cancel', underline=0, width=6, - command = lambda self=self: self.quitcmd () ) - - box.pack( anchor='s', fill='x', side=BOTTOM) - - def copy_name (self, dir, ent): - # This should work as it is the entry's textvariable - self.dlist_dir = dir.cget('value') - # but it isn't so I'll do it manually - ent.entry.delete(0,'end') - ent.entry.insert(0, self.dlist_dir) - - def okcmd (self): - # tixDemo:Status "You have selected the directory" + self.dlist_dir - self.quitcmd() - - def quitcmd (self): - # tixDemo:Status "You have selected the directory" + self.dlist_dir - self.exit = 0 - - def mainloop(self): - while self.exit < 0: - self.root.tk.dooneevent(TCL_ALL_EVENTS) - - def destroy (self): - self.root.destroy() - -# This "if" statement makes it possible to run this script file inside or -# outside of the main demo program "tixwidgets.py". -# -if __name__== '__main__' : - root=tkinter.tix.Tk() - RunSample(root) diff --git a/Demo/tix/samples/NoteBook.py b/Demo/tix/samples/NoteBook.py deleted file mode 100644 index d8b5fa8..0000000 --- a/Demo/tix/samples/NoteBook.py +++ /dev/null @@ -1,119 +0,0 @@ -# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- -# -# $Id$ -# -# Tix Demostration Program -# -# This sample program is structured in such a way so that it can be -# executed from the Tix demo program "tixwidgets.py": it must have a -# procedure called "RunSample". It should also have the "if" statment -# at the end of this file so that it can be run as a standalone -# program. - -# This file demonstrates the use of the tixNoteBook widget, which allows -# you to lay out your interface using a "notebook" metaphore -# -import tkinter.tix - -def RunSample(w): - global root - root = w - - # We use these options to set the sizes of the subwidgets inside the - # notebook, so that they are well-aligned on the screen. - prefix = tkinter.tix.OptionName(w) - if prefix: - prefix = '*'+prefix - else: - prefix = '' - w.option_add(prefix+'*TixControl*entry.width', 10) - w.option_add(prefix+'*TixControl*label.width', 18) - w.option_add(prefix+'*TixControl*label.anchor', tkinter.tix.E) - w.option_add(prefix+'*TixNoteBook*tagPadX', 8) - - # Create the notebook widget and set its backpagecolor to gray. - # Note that the -backpagecolor option belongs to the "nbframe" - # subwidget. - nb = tkinter.tix.NoteBook(w, name='nb', ipadx=6, ipady=6) - nb['bg'] = 'gray' - nb.nbframe['backpagecolor'] = 'gray' - - # Create the two tabs on the notebook. The -underline option - # puts a underline on the first character of the labels of the tabs. - # Keyboard accelerators will be defined automatically according - # to the underlined character. - nb.add('hard_disk', label="Hard Disk", underline=0) - nb.add('network', label="Network", underline=0) - - nb.pack(expand=1, fill=tkinter.tix.BOTH, padx=5, pady=5 ,side=tkinter.tix.TOP) - - #---------------------------------------- - # Create the first page - #---------------------------------------- - # Create two frames: one for the common buttons, one for the - # other widgets - # - tab=nb.hard_disk - f = tkinter.tix.Frame(tab) - common = tkinter.tix.Frame(tab) - - f.pack(side=tkinter.tix.LEFT, padx=2, pady=2, fill=tkinter.tix.BOTH, expand=1) - common.pack(side=tkinter.tix.RIGHT, padx=2, fill=tkinter.tix.Y) - - a = tkinter.tix.Control(f, value=12, label='Access time: ') - w = tkinter.tix.Control(f, value=400, label='Write Throughput: ') - r = tkinter.tix.Control(f, value=400, label='Read Throughput: ') - c = tkinter.tix.Control(f, value=1021, label='Capacity: ') - - a.pack(side=tkinter.tix.TOP, padx=20, pady=2) - w.pack(side=tkinter.tix.TOP, padx=20, pady=2) - r.pack(side=tkinter.tix.TOP, padx=20, pady=2) - c.pack(side=tkinter.tix.TOP, padx=20, pady=2) - - # Create the common buttons - createCommonButtons(common) - - #---------------------------------------- - # Create the second page - #---------------------------------------- - - tab = nb.network - - f = tkinter.tix.Frame(tab) - common = tkinter.tix.Frame(tab) - - f.pack(side=tkinter.tix.LEFT, padx=2, pady=2, fill=tkinter.tix.BOTH, expand=1) - common.pack(side=tkinter.tix.RIGHT, padx=2, fill=tkinter.tix.Y) - - a = tkinter.tix.Control(f, value=12, label='Access time: ') - w = tkinter.tix.Control(f, value=400, label='Write Throughput: ') - r = tkinter.tix.Control(f, value=400, label='Read Throughput: ') - c = tkinter.tix.Control(f, value=1021, label='Capacity: ') - u = tkinter.tix.Control(f, value=10, label='Users: ') - - a.pack(side=tkinter.tix.TOP, padx=20, pady=2) - w.pack(side=tkinter.tix.TOP, padx=20, pady=2) - r.pack(side=tkinter.tix.TOP, padx=20, pady=2) - c.pack(side=tkinter.tix.TOP, padx=20, pady=2) - u.pack(side=tkinter.tix.TOP, padx=20, pady=2) - - createCommonButtons(common) - -def doDestroy(): - global root - root.destroy() - -def createCommonButtons(master): - ok = tkinter.tix.Button(master, name='ok', text='OK', width=6, - command=doDestroy) - cancel = tkinter.tix.Button(master, name='cancel', - text='Cancel', width=6, - command=doDestroy) - - ok.pack(side=tkinter.tix.TOP, padx=2, pady=2) - cancel.pack(side=tkinter.tix.TOP, padx=2, pady=2) - -if __name__ == '__main__': - root = tkinter.tix.Tk() - RunSample(root) - root.mainloop() diff --git a/Demo/tix/samples/OptMenu.py b/Demo/tix/samples/OptMenu.py deleted file mode 100644 index d1dd46d..0000000 --- a/Demo/tix/samples/OptMenu.py +++ /dev/null @@ -1,68 +0,0 @@ -# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- -# -# $Id$ -# -# Tix Demostration Program -# -# This sample program is structured in such a way so that it can be -# executed from the Tix demo program "tixwidgets.py": it must have a -# procedure called "RunSample". It should also have the "if" statment -# at the end of this file so that it can be run as a standalone -# program. - -# This file demonstrates the use of the tixOptionMenu widget -- you can -# use it for the user to choose from a fixed set of options -# -import tkinter.tix - -options = {'text':'Plain Text', 'post':'PostScript', 'html':'HTML', - 'tex':'LaTeX', 'rtf':'Rich Text Format'} - -def RunSample(w): - global demo_opt_from, demo_opt_to - - demo_opt_from = tkinter.tix.StringVar() - demo_opt_to = tkinter.tix.StringVar() - - top = tkinter.tix.Frame(w, bd=1, relief=tkinter.tix.RAISED) - - from_file = tkinter.tix.OptionMenu(top, label="From File Format : ", - variable=demo_opt_from, - options = 'label.width 19 label.anchor e menubutton.width 15') - - to_file = tkinter.tix.OptionMenu(top, label="To File Format : ", - variable=demo_opt_to, - options='label.width 19 label.anchor e menubutton.width 15') - - # Add the available options to the two OptionMenu widgets - # - # [Hint] You have to add the options first before you set the - # global variables "demo_opt_from" and "demo_opt_to". Otherwise - # the OptionMenu widget will complain about "unknown options"! - # - for opt in options.keys(): - from_file.add_command(opt, label=options[opt]) - to_file.add_command(opt, label=options[opt]) - - demo_opt_from.set('html') - demo_opt_to.set('post') - - from_file.pack(side=tkinter.tix.TOP, anchor=tkinter.tix.W, pady=3, padx=6) - to_file.pack(side=tkinter.tix.TOP, anchor=tkinter.tix.W, pady=3, padx=6) - - box = tkinter.tix.ButtonBox(w, orientation=tkinter.tix.HORIZONTAL) - box.add('ok', text='Ok', underline=0, width=6, - command=lambda w=w: ok_command(w)) - box.add('cancel', text='Cancel', underline=0, width=6, - command=lambda w=w: w.destroy()) - box.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.X) - top.pack(side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1) - -def ok_command(w): - # tixDemo:Status "Convert file from %s to %s" % ( demo_opt_from.get(), demo_opt_to.get()) - w.destroy() - -if __name__ == '__main__': - root = tkinter.tix.Tk() - RunSample(root) - root.mainloop() diff --git a/Demo/tix/samples/PanedWin.py b/Demo/tix/samples/PanedWin.py deleted file mode 100644 index 1ffc470..0000000 --- a/Demo/tix/samples/PanedWin.py +++ /dev/null @@ -1,98 +0,0 @@ -# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- -# -# $Id$ -# -# Tix Demostration Program -# -# This sample program is structured in such a way so that it can be -# executed from the Tix demo program "tixwidgets.py": it must have a -# procedure called "RunSample". It should also have the "if" statment -# at the end of this file so that it can be run as a standalone -# program. - -# This file demonstrates the use of the tixPanedWindow widget. This program -# is a dummy news reader: the user can adjust the sizes of the list -# of artical names and the size of the text widget that shows the body -# of the article. - -import tkinter.tix - -TCL_ALL_EVENTS = 0 - -def RunSample (root): - panedwin = DemoPanedwin(root) - panedwin.mainloop() - panedwin.destroy() - -class DemoPanedwin: - def __init__(self, w): - self.root = w - self.exit = -1 - - z = w.winfo_toplevel() - z.wm_protocol("WM_DELETE_WINDOW", lambda self=self: self.quitcmd()) - - group = tkinter.tix.LabelEntry(w, label='Newsgroup:', options='entry.width 25') - group.entry.insert(0,'comp.lang.python') - pane = tkinter.tix.PanedWindow(w, orientation='vertical') - - p1 = pane.add('list', min=70, size=100) - p2 = pane.add('text', min=70) - list = tkinter.tix.ScrolledListBox(p1) - list.listbox['width'] = 80 - list.listbox['height'] = 5 - text = tkinter.tix.ScrolledText(p2) - text.text['width'] = 80 - text.text['height'] = 20 - - list.listbox.insert(tkinter.tix.END, " 12324 Re: Tkinter is good for your health") - list.listbox.insert(tkinter.tix.END, "+ 12325 Re: Tkinter is good for your health") - list.listbox.insert(tkinter.tix.END, "+ 12326 Re: Tix is even better for your health (Was: Tkinter is good...)") - list.listbox.insert(tkinter.tix.END, " 12327 Re: Tix is even better for your health (Was: Tkinter is good...)") - list.listbox.insert(tkinter.tix.END, "+ 12328 Re: Tix is even better for your health (Was: Tkinter is good...)") - list.listbox.insert(tkinter.tix.END, " 12329 Re: Tix is even better for your health (Was: Tkinter is good...)") - list.listbox.insert(tkinter.tix.END, "+ 12330 Re: Tix is even better for your health (Was: Tkinter is good...)") - - text.text['bg'] = list.listbox['bg'] - text.text['wrap'] = 'none' - text.text.insert(tkinter.tix.END, """ - Mon, 19 Jun 1995 11:39:52 comp.lang.python Thread 34 of 220 - Lines 353 A new way to put text and bitmaps together iNo responses - ioi@blue.seas.upenn.edu Ioi K. Lam at University of Pennsylvania - - Hi, - - I have implemented a new image type called "compound". It allows you - to glue together a bunch of bitmaps, images and text strings together - to form a bigger image. Then you can use this image with widgets that - support the -image option. For example, you can display a text string string - together with a bitmap, at the same time, inside a TK button widget. - """) - text.text['state'] = 'disabled' - - list.pack(expand=1, fill=tkinter.tix.BOTH, padx=4, pady=6) - text.pack(expand=1, fill=tkinter.tix.BOTH, padx=4, pady=6) - - group.pack(side=tkinter.tix.TOP, padx=3, pady=3, fill=tkinter.tix.BOTH) - pane.pack(side=tkinter.tix.TOP, padx=3, pady=3, fill=tkinter.tix.BOTH, expand=1) - - box = tkinter.tix.ButtonBox(w, orientation=tkinter.tix.HORIZONTAL) - box.add('ok', text='Ok', underline=0, width=6, - command=self.quitcmd) - box.add('cancel', text='Cancel', underline=0, width=6, - command=self.quitcmd) - box.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.X) - - def quitcmd (self): - self.exit = 0 - - def mainloop(self): - while self.exit < 0: - self.root.tk.dooneevent(TCL_ALL_EVENTS) - - def destroy (self): - self.root.destroy() - -if __name__ == '__main__': - root = tkinter.tix.Tk() - RunSample(root) diff --git a/Demo/tix/samples/PopMenu.py b/Demo/tix/samples/PopMenu.py deleted file mode 100644 index cb75d85..0000000 --- a/Demo/tix/samples/PopMenu.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- -# -# $Id$ -# -# Tix Demostration Program -# -# This sample program is structured in such a way so that it can be -# executed from the Tix demo program "tixwidgets.py": it must have a -# procedure called "RunSample". It should also have the "if" statment -# at the end of this file so that it can be run as a standalone -# program using tixwish. - -# This file demonstrates the use of the tixPopupMenu widget. -# -import tkinter.tix - -def RunSample(w): - # We create the frame and the button, then we'll bind the PopupMenu - # to both widgets. The result is, when you press the right mouse - # button over $w.top or $w.top.but, the PopupMenu will come up. - # - top = tkinter.tix.Frame(w, relief=tkinter.tix.RAISED, bd=1) - but = tkinter.tix.Button(top, text='Press the right mouse button over this button or its surrounding area') - but.pack(expand=1, fill=tkinter.tix.BOTH, padx=50, pady=50) - - p = tkinter.tix.PopupMenu(top, title='Popup Test') - p.bind_widget(top) - p.bind_widget(but) - - # Set the entries inside the PopupMenu widget. - # [Hint] You have to manipulate the "menu" subwidget. - # $w.top.p itself is NOT a menu widget. - # [Hint] Watch carefully how the sub-menu is created - # - p.menu.add_command(label='Desktop', underline=0) - p.menu.add_command(label='Select', underline=0) - p.menu.add_command(label='Find', underline=0) - p.menu.add_command(label='System', underline=1) - p.menu.add_command(label='Help', underline=0) - m1 = tkinter.tix.Menu(p.menu) - m1.add_command(label='Hello') - p.menu.add_cascade(label='More', menu=m1) - - but.pack(side=tkinter.tix.TOP, padx=40, pady=50) - - box = tkinter.tix.ButtonBox(w, orientation=tkinter.tix.HORIZONTAL) - box.add('ok', text='Ok', underline=0, width=6, - command=lambda w=w: w.destroy()) - box.add('cancel', text='Cancel', underline=0, width=6, - command=lambda w=w: w.destroy()) - box.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.X) - top.pack(side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1) - -if __name__ == '__main__': - root = tkinter.tix.Tk() - RunSample(root) - root.mainloop() diff --git a/Demo/tix/samples/SHList1.py b/Demo/tix/samples/SHList1.py deleted file mode 100644 index bf46020..0000000 --- a/Demo/tix/samples/SHList1.py +++ /dev/null @@ -1,131 +0,0 @@ -# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- -# -# $Id$ -# -# Tix Demostration Program -# -# This sample program is structured in such a way so that it can be -# executed from the Tix demo program "tixwidgets.py": it must have a -# procedure called "RunSample". It should also have the "if" statment -# at the end of this file so that it can be run as a standalone -# program using tixwish. - -# This file demonstrates the use of the tixScrolledHList widget. -# - -import tkinter.tix - -TCL_ALL_EVENTS = 0 - -def RunSample (root): - shlist = DemoSHList(root) - shlist.mainloop() - shlist.destroy() - -class DemoSHList: - def __init__(self, w): - self.root = w - self.exit = -1 - - z = w.winfo_toplevel() - z.wm_protocol("WM_DELETE_WINDOW", lambda self=self: self.quitcmd()) - - # We create the frame and the ScrolledHList widget - # at the top of the dialog box - # - top = tkinter.tix.Frame( w, relief=tkinter.tix.RAISED, bd=1) - - # Put a simple hierachy into the HList (two levels). Use colors and - # separator widgets (frames) to make the list look fancy - # - top.a = tkinter.tix.ScrolledHList(top) - top.a.pack( expand=1, fill=tkinter.tix.BOTH, padx=10, pady=10, side=tkinter.tix.TOP) - - # This is our little relational database - # - bosses = [ - ('jeff', 'Jeff Waxman'), - ('john', 'John Lee'), - ('peter', 'Peter Kenson') - ] - - employees = [ - ('alex', 'john', 'Alex Kellman'), - ('alan', 'john', 'Alan Adams'), - ('andy', 'peter', 'Andreas Crawford'), - ('doug', 'jeff', 'Douglas Bloom'), - ('jon', 'peter', 'Jon Baraki'), - ('chris', 'jeff', 'Chris Geoffrey'), - ('chuck', 'jeff', 'Chuck McLean') - ] - - hlist=top.a.hlist - - # Let configure the appearance of the HList subwidget - # - hlist.config( separator='.', width=25, drawbranch=0, indent=10) - - count=0 - for boss,name in bosses : - if count : - f=tkinter.tix.Frame(hlist, name='sep%d' % count, height=2, width=150, - bd=2, relief=tkinter.tix.SUNKEN ) - - hlist.add_child( itemtype=tkinter.tix.WINDOW, - window=f, state=tkinter.tix.DISABLED ) - - hlist.add(boss, itemtype=tkinter.tix.TEXT, text=name) - count = count+1 - - - for person,boss,name in employees : - # '.' is the separator character we chose above - # - key= boss + '.' + person - # ^^^^ ^^^^^^ - # parent entryPath / child's name - - hlist.add( key, text=name ) - - # [Hint] Make sure the keys (e.g. 'boss.person') you choose - # are unique names. If you cannot be sure of this (because of - # the structure of your database, e.g.) you can use the - # "add_child" command instead: - # - # hlist.addchild( boss, text=name) - # ^^^^ - # parent entryPath - - - # Use a ButtonBox to hold the buttons. - # - box= tkinter.tix.ButtonBox(top, orientation=tkinter.tix.HORIZONTAL ) - box.add( 'ok', text='Ok', underline=0, width=6, - command = self.okcmd) - - box.add( 'cancel', text='Cancel', underline=0, width=6, - command = self.quitcmd) - - box.pack( side=tkinter.tix.BOTTOM, fill=tkinter.tix.X) - top.pack( side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1 ) - - def okcmd (self): - self.quitcmd() - - def quitcmd (self): - self.exit = 0 - - def mainloop(self): - while self.exit < 0: - self.root.tk.dooneevent(TCL_ALL_EVENTS) - - def destroy (self): - self.root.destroy() - - -# This "if" statement makes it possible to run this script file inside or -# outside of the main demo program "tixwidgets.py". -# -if __name__== '__main__' : - root=tkinter.tix.Tk() - RunSample(root) diff --git a/Demo/tix/samples/SHList2.py b/Demo/tix/samples/SHList2.py deleted file mode 100644 index 370c765..0000000 --- a/Demo/tix/samples/SHList2.py +++ /dev/null @@ -1,168 +0,0 @@ -# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- -# -# $Id$ -# -# Tix Demostration Program -# -# This sample program is structured in such a way so that it can be -# executed from the Tix demo program "tixwidget": it must have a -# procedure called "RunSample". It should also have the "if" statment -# at the end of this file so that it can be run as a standalone -# program using tixwish. - -# This file demonstrates how to use multiple columns and multiple styles -# in the tixHList widget -# -# In a tixHList widget, you can have one ore more columns. -# - -import tkinter.tix - -TCL_ALL_EVENTS = 0 - -def RunSample (root): - shlist = DemoSHList(root) - shlist.mainloop() - shlist.destroy() - -class DemoSHList: - def __init__(self, w): - self.root = w - self.exit = -1 - - z = w.winfo_toplevel() - z.wm_protocol("WM_DELETE_WINDOW", lambda self=self: self.quitcmd()) - - # We create the frame and the ScrolledHList widget - # at the top of the dialog box - # - top = tkinter.tix.Frame( w, relief=tkinter.tix.RAISED, bd=1) - - # Put a simple hierachy into the HList (two levels). Use colors and - # separator widgets (frames) to make the list look fancy - # - top.a = tkinter.tix.ScrolledHList(top, options='hlist.columns 3 hlist.header 1' ) - top.a.pack( expand=1, fill=tkinter.tix.BOTH, padx=10, pady=10, side=tkinter.tix.TOP) - - hlist=top.a.hlist - - # Create the title for the HList widget - # >> Notice that we have set the hlist.header subwidget option to true - # so that the header is displayed - # - - boldfont=hlist.tk.call('tix','option','get','bold_font') - - # First some styles for the headers - style={} - style['header'] = tkinter.tix.DisplayStyle(tkinter.tix.TEXT, refwindow=hlist, - anchor=tkinter.tix.CENTER, padx=8, pady=2, font = boldfont ) - - hlist.header_create(0, itemtype=tkinter.tix.TEXT, text='Name', - style=style['header']) - hlist.header_create(1, itemtype=tkinter.tix.TEXT, text='Position', - style=style['header']) - - # Notice that we use 3 columns in the hlist widget. This way when the user - # expands the windows wide, the right side of the header doesn't look - # chopped off. The following line ensures that the 3 column header is - # not shown unless the hlist window is wider than its contents. - # - hlist.column_width(2,0) - - # This is our little relational database - # - boss = ('doe', 'John Doe', 'Director') - - managers = [ - ('jeff', 'Jeff Waxman', 'Manager'), - ('john', 'John Lee', 'Manager'), - ('peter', 'Peter Kenson', 'Manager') - ] - - employees = [ - ('alex', 'john', 'Alex Kellman', 'Clerk'), - ('alan', 'john', 'Alan Adams', 'Clerk'), - ('andy', 'peter', 'Andreas Crawford', 'Salesman'), - ('doug', 'jeff', 'Douglas Bloom', 'Clerk'), - ('jon', 'peter', 'Jon Baraki', 'Salesman'), - ('chris', 'jeff', 'Chris Geoffrey', 'Clerk'), - ('chuck', 'jeff', 'Chuck McLean', 'Cleaner') - ] - - style['mgr_name'] = tkinter.tix.DisplayStyle(tkinter.tix.TEXT, refwindow=hlist) - - style['mgr_posn'] = tkinter.tix.DisplayStyle(tkinter.tix.TEXT, padx=8, refwindow=hlist) - - style['empl_name'] = tkinter.tix.DisplayStyle(tkinter.tix.TEXT, refwindow=hlist) - - style['empl_posn'] = tkinter.tix.DisplayStyle(tkinter.tix.TEXT, padx=8, refwindow=hlist) - - # Let configure the appearance of the HList subwidget - # - hlist.config(separator='.', width=25, drawbranch=0, indent=10) - hlist.column_width(0, chars=20) - - # Create the boss - # - hlist.add ('.', itemtype=tkinter.tix.TEXT, text=boss[1], - style=style['mgr_name']) - hlist.item_create('.', 1, itemtype=tkinter.tix.TEXT, text=boss[2], - style=style['mgr_posn']) - - # Create the managers - # - - for key,name,posn in managers : - e= '.'+ key - hlist.add(e, itemtype=tkinter.tix.TEXT, text=name, - style=style['mgr_name']) - hlist.item_create(e, 1, itemtype=tkinter.tix.TEXT, text=posn, - style=style['mgr_posn']) - - - for key,mgr,name,posn in employees : - # "." is the separator character we chose above - - entrypath = '.' + mgr + '.' + key - - # ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ - # parent entryPath / child's name - - hlist.add(entrypath, text=name, style=style['empl_name']) - hlist.item_create(entrypath, 1, itemtype=tkinter.tix.TEXT, - text = posn, style = style['empl_posn'] ) - - - # Use a ButtonBox to hold the buttons. - # - box= tkinter.tix.ButtonBox(top, orientation=tkinter.tix.HORIZONTAL ) - box.add( 'ok', text='Ok', underline=0, width=6, - command = self.okcmd ) - - box.add( 'cancel', text='Cancel', underline=0, width=6, - command = self.quitcmd ) - - box.pack( side=tkinter.tix.BOTTOM, fill=tkinter.tix.X) - top.pack( side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1 ) - - def okcmd (self): - self.quitcmd() - - def quitcmd (self): - self.exit = 0 - - def mainloop(self): - while self.exit < 0: - self.root.tk.dooneevent(TCL_ALL_EVENTS) - - def destroy (self): - self.root.destroy() - - -# This "if" statement makes it possible to run this script file inside or -# outside of the main demo program "tixwidgets.py". -# -if __name__== '__main__' : - root=tkinter.tix.Tk() - RunSample(root) diff --git a/Demo/tix/samples/Tree.py b/Demo/tix/samples/Tree.py deleted file mode 100644 index e46ff60..0000000 --- a/Demo/tix/samples/Tree.py +++ /dev/null @@ -1,80 +0,0 @@ -# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- -# -# $Id$ -# -# Tix Demostration Program -# -# This sample program is structured in such a way so that it can be -# executed from the Tix demo program "tixwidgets.py": it must have a -# procedure called "RunSample". It should also have the "if" statment -# at the end of this file so that it can be run as a standalone -# program. - -# This file demonstrates how to use the TixTree widget to display -# dynamic hierachical data (the files in the Unix file system) -# - -import tkinter.tix, os - -def RunSample(w): - top = tkinter.tix.Frame(w, relief=tkinter.tix.RAISED, bd=1) - tree = tkinter.tix.Tree(top, options='separator "/"') - tree.pack(expand=1, fill=tkinter.tix.BOTH, padx=10, pady=10, side=tkinter.tix.LEFT) - tree['opencmd'] = lambda dir=None, w=tree: opendir(w, dir) - - # The / directory is added in the "open" mode. The user can open it - # and then browse its subdirectories ... - adddir(tree, "/") - - box = tkinter.tix.ButtonBox(w, orientation=tkinter.tix.HORIZONTAL) - box.add('ok', text='Ok', underline=0, command=w.destroy, width=6) - box.add('cancel', text='Cancel', underline=0, command=w.destroy, width=6) - box.pack(side=tkinter.tix.BOTTOM, fill=tkinter.tix.X) - top.pack(side=tkinter.tix.TOP, fill=tkinter.tix.BOTH, expand=1) - -def adddir(tree, dir): - if dir == '/': - text = '/' - else: - text = os.path.basename(dir) - tree.hlist.add(dir, itemtype=tkinter.tix.IMAGETEXT, text=text, - image=tree.tk.call('tix', 'getimage', 'folder')) - try: - os.listdir(dir) - tree.setmode(dir, 'open') - except os.error: - # No read permission ? - pass - -# This function is called whenever the user presses the (+) indicator or -# double clicks on a directory whose mode is "open". It loads the files -# inside that directory into the Tree widget. -# -# Note we didn't specify the closecmd option for the Tree widget, so it -# performs the default action when the user presses the (-) indicator or -# double clicks on a directory whose mode is "close": hide all of its child -# entries -def opendir(tree, dir): - entries = tree.hlist.info_children(dir) - if entries: - # We have already loaded this directory. Let's just - # show all the child entries - # - # Note: since we load the directory only once, it will not be - # refreshed if the you add or remove files from this - # directory. - # - for entry in entries: - tree.hlist.show_entry(entry) - files = os.listdir(dir) - for file in files: - if os.path.isdir(dir + '/' + file): - adddir(tree, dir + '/' + file) - else: - tree.hlist.add(dir + '/' + file, itemtype=tkinter.tix.IMAGETEXT, text=file, - image=tree.tk.call('tix', 'getimage', 'file')) - -if __name__ == '__main__': - root = tkinter.tix.Tk() - RunSample(root) - root.mainloop() diff --git a/Demo/tix/tixwidgets.py b/Demo/tix/tixwidgets.py deleted file mode 100644 index 42bcedc..0000000 --- a/Demo/tix/tixwidgets.py +++ /dev/null @@ -1,1002 +0,0 @@ -# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- -# -# $Id$ -# -# tixwidgets.py -- -# -# For Tix, see http://tix.sourceforge.net -# -# This is a demo program of some of the Tix widgets available in Python. -# If you have installed Python & Tix properly, you can execute this as -# -# % python tixwidgets.py -# - -import os, os.path, sys, tkinter.tix -from tkinter.constants import * -import traceback, tkinter.messagebox - -TCL_DONT_WAIT = 1<<1 -TCL_WINDOW_EVENTS = 1<<2 -TCL_FILE_EVENTS = 1<<3 -TCL_TIMER_EVENTS = 1<<4 -TCL_IDLE_EVENTS = 1<<5 -TCL_ALL_EVENTS = 0 - -class Demo: - def __init__(self, top): - self.root = top - self.exit = -1 - - self.dir = None # script directory - self.balloon = None # balloon widget - self.useBalloons = tkinter.tix.StringVar() - self.useBalloons.set('0') - self.statusbar = None # status bar widget - self.welmsg = None # Msg widget - self.welfont = '' # font name - self.welsize = '' # font size - - progname = sys.argv[0] - dirname = os.path.dirname(progname) - if dirname and dirname != os.curdir: - self.dir = dirname - index = -1 - for i in range(len(sys.path)): - p = sys.path[i] - if p in ("", os.curdir): - index = i - if index >= 0: - sys.path[index] = dirname - else: - sys.path.insert(0, dirname) - else: - self.dir = os.getcwd() - sys.path.insert(0, self.dir+'/samples') - - def MkMainMenu(self): - top = self.root - w = tkinter.tix.Frame(top, bd=2, relief=RAISED) - file = tkinter.tix.Menubutton(w, text='File', underline=0, takefocus=0) - help = tkinter.tix.Menubutton(w, text='Help', underline=0, takefocus=0) - file.pack(side=LEFT) - help.pack(side=RIGHT) - fm = tkinter.tix.Menu(file, tearoff=0) - file['menu'] = fm - hm = tkinter.tix.Menu(help, tearoff=0) - help['menu'] = hm - - fm.add_command(label='Exit', underline=1, - command = lambda self=self: self.quitcmd () ) - hm.add_checkbutton(label='BalloonHelp', underline=0, command=ToggleHelp, - variable=self.useBalloons) - # The trace variable option doesn't seem to work, instead I use 'command' - #w.tk.call('trace', 'variable', self.useBalloons, 'w', ToggleHelp)) - - return w - - def MkMainNotebook(self): - top = self.root - w = tkinter.tix.NoteBook(top, ipadx=5, ipady=5, options=""" - tagPadX 6 - tagPadY 4 - borderWidth 2 - """) - # This may be required if there is no *Background option - top['bg'] = w['bg'] - - w.add('wel', label='Welcome', underline=0, - createcmd=lambda w=w, name='wel': MkWelcome(w, name)) - w.add('cho', label='Choosers', underline=0, - createcmd=lambda w=w, name='cho': MkChoosers(w, name)) - w.add('scr', label='Scrolled Widgets', underline=0, - createcmd=lambda w=w, name='scr': MkScroll(w, name)) - w.add('mgr', label='Manager Widgets', underline=0, - createcmd=lambda w=w, name='mgr': MkManager(w, name)) - w.add('dir', label='Directory List', underline=0, - createcmd=lambda w=w, name='dir': MkDirList(w, name)) - w.add('exp', label='Run Sample Programs', underline=0, - createcmd=lambda w=w, name='exp': MkSample(w, name)) - return w - - def MkMainStatus(self): - global demo - top = self.root - - w = tkinter.tix.Frame(top, relief=tkinter.tix.RAISED, bd=1) - demo.statusbar = tkinter.tix.Label(w, relief=tkinter.tix.SUNKEN, bd=1) - demo.statusbar.form(padx=3, pady=3, left=0, right='%70') - return w - - def build(self): - root = self.root - z = root.winfo_toplevel() - z.wm_title('Tix Widget Demonstration') - if z.winfo_screenwidth() <= 800: - z.geometry('790x590+10+10') - else: - z.geometry('890x640+10+10') - demo.balloon = tkinter.tix.Balloon(root) - frame1 = self.MkMainMenu() - frame2 = self.MkMainNotebook() - frame3 = self.MkMainStatus() - frame1.pack(side=TOP, fill=X) - frame3.pack(side=BOTTOM, fill=X) - frame2.pack(side=TOP, expand=1, fill=BOTH, padx=4, pady=4) - demo.balloon['statusbar'] = demo.statusbar - z.wm_protocol("WM_DELETE_WINDOW", lambda self=self: self.quitcmd()) - - # To show Tcl errors - uncomment this to see the listbox bug. - # Tkinter defines a Tcl tkerror procedure that in effect - # silences all background Tcl error reporting. - # root.tk.eval('if {[info commands tkerror] != ""} {rename tkerror pytkerror}') - def quitcmd (self): - """Quit our mainloop. It is up to you to call root.destroy() after.""" - self.exit = 0 - - def loop(self): - """This is an explict replacement for _tkinter mainloop() - It lets you catch keyboard interrupts easier, and avoids - the 20 msec. dead sleep() which burns a constant CPU.""" - while self.exit < 0: - # There are 2 whiles here. The outer one lets you continue - # after a ^C interrupt. - try: - # This is the replacement for _tkinter mainloop() - # It blocks waiting for the next Tcl event using select. - while self.exit < 0: - self.root.tk.dooneevent(TCL_ALL_EVENTS) - except SystemExit: - # Tkinter uses SystemExit to exit - #print 'Exit' - self.exit = 1 - return - except KeyboardInterrupt: - if tkinter.messagebox.askquestion ('Interrupt', 'Really Quit?') == 'yes': - # self.tk.eval('exit') - self.exit = 1 - return - continue - except: - # Otherwise it's some other error - be nice and say why - t, v, tb = sys.exc_info() - text = "" - for line in traceback.format_exception(t,v,tb): - text += line + '\n' - try: tkinter.messagebox.showerror ('Error', text) - except: pass - self.exit = 1 - raise SystemExit(1) - - def destroy (self): - self.root.destroy() - -def RunMain(root): - global demo - - demo = Demo(root) - - demo.build() - demo.loop() - demo.destroy() - -# Tabs -def MkWelcome(nb, name): - w = nb.page(name) - bar = MkWelcomeBar(w) - text = MkWelcomeText(w) - bar.pack(side=TOP, fill=X, padx=2, pady=2) - text.pack(side=TOP, fill=BOTH, expand=1) - -def MkWelcomeBar(top): - global demo - - w = tkinter.tix.Frame(top, bd=2, relief=tkinter.tix.GROOVE) - b1 = tkinter.tix.ComboBox(w, command=lambda w=top: MainTextFont(w)) - b2 = tkinter.tix.ComboBox(w, command=lambda w=top: MainTextFont(w)) - b1.entry['width'] = 15 - b1.slistbox.listbox['height'] = 3 - b2.entry['width'] = 4 - b2.slistbox.listbox['height'] = 3 - - demo.welfont = b1 - demo.welsize = b2 - - b1.insert(tkinter.tix.END, 'Courier') - b1.insert(tkinter.tix.END, 'Helvetica') - b1.insert(tkinter.tix.END, 'Lucida') - b1.insert(tkinter.tix.END, 'Times Roman') - - b2.insert(tkinter.tix.END, '8') - b2.insert(tkinter.tix.END, '10') - b2.insert(tkinter.tix.END, '12') - b2.insert(tkinter.tix.END, '14') - b2.insert(tkinter.tix.END, '18') - - b1.pick(1) - b2.pick(3) - - b1.pack(side=tkinter.tix.LEFT, padx=4, pady=4) - b2.pack(side=tkinter.tix.LEFT, padx=4, pady=4) - - demo.balloon.bind_widget(b1, msg='Choose\na font', - statusmsg='Choose a font for this page') - demo.balloon.bind_widget(b2, msg='Point size', - statusmsg='Choose the font size for this page') - return w - -def MkWelcomeText(top): - global demo - - w = tkinter.tix.ScrolledWindow(top, scrollbar='auto') - win = w.window - text = 'Welcome to TIX in Python' - title = tkinter.tix.Label(win, - bd=0, width=30, anchor=tkinter.tix.N, text=text) - msg = tkinter.tix.Message(win, - bd=0, width=400, anchor=tkinter.tix.N, - text='Tix is a set of mega-widgets based on TK. This program \ -demonstrates the widgets in the Tix widget set. You can choose the pages \ -in this window to look at the corresponding widgets. \n\n\ -To quit this program, choose the "File | Exit" command.\n\n\ -For more information, see http://tix.sourceforge.net.') - title.pack(expand=1, fill=tkinter.tix.BOTH, padx=10, pady=10) - msg.pack(expand=1, fill=tkinter.tix.BOTH, padx=10, pady=10) - demo.welmsg = msg - return w - -def MainTextFont(w): - global demo - - if not demo.welmsg: - return - font = demo.welfont['value'] - point = demo.welsize['value'] - if font == 'Times Roman': - font = 'times' - fontstr = '%s %s' % (font, point) - demo.welmsg['font'] = fontstr - -def ToggleHelp(): - if demo.useBalloons.get() == '1': - demo.balloon['state'] = 'both' - else: - demo.balloon['state'] = 'none' - -def MkChoosers(nb, name): - w = nb.page(name) - options = "label.padX 4" - - til = tkinter.tix.LabelFrame(w, label='Chooser Widgets', options=options) - cbx = tkinter.tix.LabelFrame(w, label='tixComboBox', options=options) - ctl = tkinter.tix.LabelFrame(w, label='tixControl', options=options) - sel = tkinter.tix.LabelFrame(w, label='tixSelect', options=options) - opt = tkinter.tix.LabelFrame(w, label='tixOptionMenu', options=options) - fil = tkinter.tix.LabelFrame(w, label='tixFileEntry', options=options) - fbx = tkinter.tix.LabelFrame(w, label='tixFileSelectBox', options=options) - tbr = tkinter.tix.LabelFrame(w, label='Tool Bar', options=options) - - MkTitle(til.frame) - MkCombo(cbx.frame) - MkControl(ctl.frame) - MkSelect(sel.frame) - MkOptMenu(opt.frame) - MkFileEnt(fil.frame) - MkFileBox(fbx.frame) - MkToolBar(tbr.frame) - - # First column: comBox and selector - cbx.form(top=0, left=0, right='%33') - sel.form(left=0, right='&'+str(cbx), top=cbx) - opt.form(left=0, right='&'+str(cbx), top=sel, bottom=-1) - - # Second column: title .. etc - til.form(left=cbx, top=0,right='%66') - ctl.form(left=cbx, right='&'+str(til), top=til) - fil.form(left=cbx, right='&'+str(til), top=ctl) - tbr.form(left=cbx, right='&'+str(til), top=fil, bottom=-1) - - # - # Third column: file selection - fbx.form(right=-1, top=0, left='%66') - -def MkCombo(w): - options="label.width %d label.anchor %s entry.width %d" % (10, tkinter.tix.E, 14) - - static = tkinter.tix.ComboBox(w, label='Static', editable=0, options=options) - editable = tkinter.tix.ComboBox(w, label='Editable', editable=1, options=options) - history = tkinter.tix.ComboBox(w, label='History', editable=1, history=1, - anchor=tkinter.tix.E, options=options) - static.insert(tkinter.tix.END, 'January') - static.insert(tkinter.tix.END, 'February') - static.insert(tkinter.tix.END, 'March') - static.insert(tkinter.tix.END, 'April') - static.insert(tkinter.tix.END, 'May') - static.insert(tkinter.tix.END, 'June') - static.insert(tkinter.tix.END, 'July') - static.insert(tkinter.tix.END, 'August') - static.insert(tkinter.tix.END, 'September') - static.insert(tkinter.tix.END, 'October') - static.insert(tkinter.tix.END, 'November') - static.insert(tkinter.tix.END, 'December') - - editable.insert(tkinter.tix.END, 'Angola') - editable.insert(tkinter.tix.END, 'Bangladesh') - editable.insert(tkinter.tix.END, 'China') - editable.insert(tkinter.tix.END, 'Denmark') - editable.insert(tkinter.tix.END, 'Ecuador') - - history.insert(tkinter.tix.END, '/usr/bin/ksh') - history.insert(tkinter.tix.END, '/usr/local/lib/python') - history.insert(tkinter.tix.END, '/var/adm') - - static.pack(side=tkinter.tix.TOP, padx=5, pady=3) - editable.pack(side=tkinter.tix.TOP, padx=5, pady=3) - history.pack(side=tkinter.tix.TOP, padx=5, pady=3) - -states = ['Bengal', 'Delhi', 'Karnataka', 'Tamil Nadu'] - -def spin_cmd(w, inc): - idx = states.index(demo_spintxt.get()) + inc - if idx < 0: - idx = len(states) - 1 - elif idx >= len(states): - idx = 0 -# following doesn't work. -# return states[idx] - demo_spintxt.set(states[idx]) # this works - -def spin_validate(w): - global states, demo_spintxt - - try: - i = states.index(demo_spintxt.get()) - except ValueError: - return states[0] - return states[i] - # why this procedure works as opposed to the previous one beats me. - -def MkControl(w): - global demo_spintxt - - options="label.width %d label.anchor %s entry.width %d" % (10, tkinter.tix.E, 13) - - demo_spintxt = tkinter.tix.StringVar() - demo_spintxt.set(states[0]) - simple = tkinter.tix.Control(w, label='Numbers', options=options) - spintxt = tkinter.tix.Control(w, label='States', variable=demo_spintxt, - options=options) - spintxt['incrcmd'] = lambda w=spintxt: spin_cmd(w, 1) - spintxt['decrcmd'] = lambda w=spintxt: spin_cmd(w, -1) - spintxt['validatecmd'] = lambda w=spintxt: spin_validate(w) - - simple.pack(side=tkinter.tix.TOP, padx=5, pady=3) - spintxt.pack(side=tkinter.tix.TOP, padx=5, pady=3) - -def MkSelect(w): - options = "label.anchor %s" % tkinter.tix.CENTER - - sel1 = tkinter.tix.Select(w, label='Mere Mortals', allowzero=1, radio=1, - orientation=tkinter.tix.VERTICAL, - labelside=tkinter.tix.TOP, - options=options) - sel2 = tkinter.tix.Select(w, label='Geeks', allowzero=1, radio=0, - orientation=tkinter.tix.VERTICAL, - labelside= tkinter.tix.TOP, - options=options) - - sel1.add('eat', text='Eat') - sel1.add('work', text='Work') - sel1.add('play', text='Play') - sel1.add('party', text='Party') - sel1.add('sleep', text='Sleep') - - sel2.add('eat', text='Eat') - sel2.add('prog1', text='Program') - sel2.add('prog2', text='Program') - sel2.add('prog3', text='Program') - sel2.add('sleep', text='Sleep') - - sel1.pack(side=tkinter.tix.LEFT, padx=5, pady=3, fill=tkinter.tix.X) - sel2.pack(side=tkinter.tix.LEFT, padx=5, pady=3, fill=tkinter.tix.X) - -def MkOptMenu(w): - options='menubutton.width 15 label.anchor %s' % tkinter.tix.E - - m = tkinter.tix.OptionMenu(w, label='File Format : ', options=options) - m.add_command('text', label='Plain Text') - m.add_command('post', label='PostScript') - m.add_command('format', label='Formatted Text') - m.add_command('html', label='HTML') - m.add_command('sep') - m.add_command('tex', label='LaTeX') - m.add_command('rtf', label='Rich Text Format') - - m.pack(fill=tkinter.tix.X, padx=5, pady=3) - -def MkFileEnt(w): - msg = tkinter.tix.Message(w, - relief=tkinter.tix.FLAT, width=240, anchor=tkinter.tix.N, - text='Press the "open file" icon button and a TixFileSelectDialog will popup.') - ent = tkinter.tix.FileEntry(w, label='Select a file : ') - msg.pack(side=tkinter.tix.TOP, expand=1, fill=tkinter.tix.BOTH, padx=3, pady=3) - ent.pack(side=tkinter.tix.TOP, fill=tkinter.tix.X, padx=3, pady=3) - -def MkFileBox(w): - """The FileSelectBox is a Motif-style box with various enhancements. - For example, you can adjust the size of the two listboxes - and your past selections are recorded. - """ - msg = tkinter.tix.Message(w, - relief=tkinter.tix.FLAT, width=240, anchor=tkinter.tix.N, - text='The Tix FileSelectBox is a Motif-style box with various enhancements. For example, you can adjust the size of the two listboxes and your past selections are recorded.') - box = tkinter.tix.FileSelectBox(w) - msg.pack(side=tkinter.tix.TOP, expand=1, fill=tkinter.tix.BOTH, padx=3, pady=3) - box.pack(side=tkinter.tix.TOP, fill=tkinter.tix.X, padx=3, pady=3) - -def MkToolBar(w): - """The Select widget is also good for arranging buttons in a tool bar. - """ - global demo - - options='frame.borderWidth 1' - - msg = tkinter.tix.Message(w, - relief=tkinter.tix.FLAT, width=240, anchor=tkinter.tix.N, - text='The Select widget is also good for arranging buttons in a tool bar.') - bar = tkinter.tix.Frame(w, bd=2, relief=tkinter.tix.RAISED) - font = tkinter.tix.Select(w, allowzero=1, radio=0, label='', options=options) - para = tkinter.tix.Select(w, allowzero=0, radio=1, label='', options=options) - - font.add('bold', bitmap='@' + demo.dir + '/bitmaps/bold.xbm') - font.add('italic', bitmap='@' + demo.dir + '/bitmaps/italic.xbm') - font.add('underline', bitmap='@' + demo.dir + '/bitmaps/underline.xbm') - font.add('capital', bitmap='@' + demo.dir + '/bitmaps/capital.xbm') - - para.add('left', bitmap='@' + demo.dir + '/bitmaps/leftj.xbm') - para.add('right', bitmap='@' + demo.dir + '/bitmaps/rightj.xbm') - para.add('center', bitmap='@' + demo.dir + '/bitmaps/centerj.xbm') - para.add('justify', bitmap='@' + demo.dir + '/bitmaps/justify.xbm') - - msg.pack(side=tkinter.tix.TOP, expand=1, fill=tkinter.tix.BOTH, padx=3, pady=3) - bar.pack(side=tkinter.tix.TOP, fill=tkinter.tix.X, padx=3, pady=3) - font.pack({'in':bar}, side=tkinter.tix.LEFT, padx=3, pady=3) - para.pack({'in':bar}, side=tkinter.tix.LEFT, padx=3, pady=3) - -def MkTitle(w): - msg = tkinter.tix.Message(w, - relief=tkinter.tix.FLAT, width=240, anchor=tkinter.tix.N, - text='There are many types of "chooser" widgets that allow the user to input different types of information') - msg.pack(side=tkinter.tix.TOP, expand=1, fill=tkinter.tix.BOTH, padx=3, pady=3) - -def MkScroll(nb, name): - w = nb.page(name) - options='label.padX 4' - - sls = tkinter.tix.LabelFrame(w, label='Tix.ScrolledListBox', options=options) - swn = tkinter.tix.LabelFrame(w, label='Tix.ScrolledWindow', options=options) - stx = tkinter.tix.LabelFrame(w, label='Tix.ScrolledText', options=options) - - MkSList(sls.frame) - MkSWindow(swn.frame) - MkSText(stx.frame) - - sls.form(top=0, left=0, right='%33', bottom=-1) - swn.form(top=0, left=sls, right='%66', bottom=-1) - stx.form(top=0, left=swn, right=-1, bottom=-1) - - -def MkSList(w): - """This TixScrolledListBox is configured so that it uses scrollbars - only when it is necessary. Use the handles to resize the listbox and - watch the scrollbars automatically appear and disappear. """ - top = tkinter.tix.Frame(w, width=300, height=330) - bot = tkinter.tix.Frame(w) - msg = tkinter.tix.Message(top, - relief=tkinter.tix.FLAT, width=200, anchor=tkinter.tix.N, - text='This TixScrolledListBox is configured so that it uses scrollbars only when it is necessary. Use the handles to resize the listbox and watch the scrollbars automatically appear and disappear.') - - list = tkinter.tix.ScrolledListBox(top, scrollbar='auto') - list.place(x=50, y=150, width=120, height=80) - list.listbox.insert(tkinter.tix.END, 'Alabama') - list.listbox.insert(tkinter.tix.END, 'California') - list.listbox.insert(tkinter.tix.END, 'Montana') - list.listbox.insert(tkinter.tix.END, 'New Jersey') - list.listbox.insert(tkinter.tix.END, 'New York') - list.listbox.insert(tkinter.tix.END, 'Pennsylvania') - list.listbox.insert(tkinter.tix.END, 'Washington') - - rh = tkinter.tix.ResizeHandle(top, bg='black', - relief=tkinter.tix.RAISED, - handlesize=8, gridded=1, minwidth=50, minheight=30) - btn = tkinter.tix.Button(bot, text='Reset', command=lambda w=rh, x=list: SList_reset(w,x)) - top.propagate(0) - msg.pack(fill=tkinter.tix.X) - btn.pack(anchor=tkinter.tix.CENTER) - top.pack(expand=1, fill=tkinter.tix.BOTH) - bot.pack(fill=tkinter.tix.BOTH) - list.bind('<Map>', func=lambda arg=0, rh=rh, list=list: - list.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(list))) - -def SList_reset(rh, list): - list.place(x=50, y=150, width=120, height=80) - list.update() - rh.attach_widget(list) - -def MkSWindow(w): - """The ScrolledWindow widget allows you to scroll any kind of Tk - widget. It is more versatile than a scrolled canvas widget. - """ - global demo - - text = 'The Tix ScrolledWindow widget allows you to scroll any kind of Tk widget. It is more versatile than a scrolled canvas widget.' - - file = os.path.join(demo.dir, 'bitmaps', 'tix.gif') - if not os.path.isfile(file): - text += ' (Image missing)' - - top = tkinter.tix.Frame(w, width=330, height=330) - bot = tkinter.tix.Frame(w) - msg = tkinter.tix.Message(top, - relief=tkinter.tix.FLAT, width=200, anchor=tkinter.tix.N, - text=text) - - win = tkinter.tix.ScrolledWindow(top, scrollbar='auto') - - image1 = win.window.image_create('photo', file=file) - lbl = tkinter.tix.Label(win.window, image=image1) - lbl.pack(expand=1, fill=tkinter.tix.BOTH) - - win.place(x=30, y=150, width=190, height=120) - - rh = tkinter.tix.ResizeHandle(top, bg='black', - relief=tkinter.tix.RAISED, - handlesize=8, gridded=1, minwidth=50, minheight=30) - btn = tkinter.tix.Button(bot, text='Reset', command=lambda w=rh, x=win: SWindow_reset(w,x)) - top.propagate(0) - msg.pack(fill=tkinter.tix.X) - btn.pack(anchor=tkinter.tix.CENTER) - top.pack(expand=1, fill=tkinter.tix.BOTH) - bot.pack(fill=tkinter.tix.BOTH) - - win.bind('<Map>', func=lambda arg=0, rh=rh, win=win: - win.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(win))) - -def SWindow_reset(rh, win): - win.place(x=30, y=150, width=190, height=120) - win.update() - rh.attach_widget(win) - -def MkSText(w): - """The TixScrolledWindow widget allows you to scroll any kind of Tk - widget. It is more versatile than a scrolled canvas widget.""" - top = tkinter.tix.Frame(w, width=330, height=330) - bot = tkinter.tix.Frame(w) - msg = tkinter.tix.Message(top, - relief=tkinter.tix.FLAT, width=200, anchor=tkinter.tix.N, - text='The Tix ScrolledWindow widget allows you to scroll any kind of Tk widget. It is more versatile than a scrolled canvas widget.') - - win = tkinter.tix.ScrolledText(top, scrollbar='auto') - win.text['wrap'] = 'none' - win.text.insert(tkinter.tix.END, '''When -scrollbar is set to "auto", the -scrollbars are shown only when needed. -Additional modifiers can be used to force a -scrollbar to be shown or hidden. For example, -"auto -y" means the horizontal scrollbar -should be shown when needed but the vertical -scrollbar should always be hidden; -"auto +x" means the vertical scrollbar -should be shown when needed but the horizontal -scrollbar should always be shown, and so on.''' -) - win.place(x=30, y=150, width=190, height=100) - - rh = tkinter.tix.ResizeHandle(top, bg='black', - relief=tkinter.tix.RAISED, - handlesize=8, gridded=1, minwidth=50, minheight=30) - btn = tkinter.tix.Button(bot, text='Reset', command=lambda w=rh, x=win: SText_reset(w,x)) - top.propagate(0) - msg.pack(fill=tkinter.tix.X) - btn.pack(anchor=tkinter.tix.CENTER) - top.pack(expand=1, fill=tkinter.tix.BOTH) - bot.pack(fill=tkinter.tix.BOTH) - win.bind('<Map>', func=lambda arg=0, rh=rh, win=win: - win.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(win))) - -def SText_reset(rh, win): - win.place(x=30, y=150, width=190, height=120) - win.update() - rh.attach_widget(win) - -def MkManager(nb, name): - w = nb.page(name) - options='label.padX 4' - - pane = tkinter.tix.LabelFrame(w, label='Tix.PanedWindow', options=options) - note = tkinter.tix.LabelFrame(w, label='Tix.NoteBook', options=options) - - MkPanedWindow(pane.frame) - MkNoteBook(note.frame) - - pane.form(top=0, left=0, right=note, bottom=-1) - note.form(top=0, right=-1, bottom=-1) - -def MkPanedWindow(w): - """The PanedWindow widget allows the user to interactively manipulate - the sizes of several panes. The panes can be arranged either vertically - or horizontally. - """ - msg = tkinter.tix.Message(w, - relief=tkinter.tix.FLAT, width=240, anchor=tkinter.tix.N, - text='The PanedWindow widget allows the user to interactively manipulate the sizes of several panes. The panes can be arranged either vertically or horizontally.') - group = tkinter.tix.LabelEntry(w, label='Newsgroup:', options='entry.width 25') - group.entry.insert(0,'comp.lang.python') - pane = tkinter.tix.PanedWindow(w, orientation='vertical') - - p1 = pane.add('list', min=70, size=100) - p2 = pane.add('text', min=70) - list = tkinter.tix.ScrolledListBox(p1) - text = tkinter.tix.ScrolledText(p2) - - list.listbox.insert(tkinter.tix.END, " 12324 Re: Tkinter is good for your health") - list.listbox.insert(tkinter.tix.END, "+ 12325 Re: Tkinter is good for your health") - list.listbox.insert(tkinter.tix.END, "+ 12326 Re: Tix is even better for your health (Was: Tkinter is good...)") - list.listbox.insert(tkinter.tix.END, " 12327 Re: Tix is even better for your health (Was: Tkinter is good...)") - list.listbox.insert(tkinter.tix.END, "+ 12328 Re: Tix is even better for your health (Was: Tkinter is good...)") - list.listbox.insert(tkinter.tix.END, " 12329 Re: Tix is even better for your health (Was: Tkinter is good...)") - list.listbox.insert(tkinter.tix.END, "+ 12330 Re: Tix is even better for your health (Was: Tkinter is good...)") - - text.text['bg'] = list.listbox['bg'] - text.text['wrap'] = 'none' - text.text.insert(tkinter.tix.END, """ -Mon, 19 Jun 1995 11:39:52 comp.lang.python Thread 34 of 220 -Lines 353 A new way to put text and bitmaps together iNo responses -ioi@blue.seas.upenn.edu Ioi K. Lam at University of Pennsylvania - -Hi, - -I have implemented a new image type called "compound". It allows you -to glue together a bunch of bitmaps, images and text strings together -to form a bigger image. Then you can use this image with widgets that -support the -image option. For example, you can display a text string string -together with a bitmap, at the same time, inside a TK button widget. -""") - list.pack(expand=1, fill=tkinter.tix.BOTH, padx=4, pady=6) - text.pack(expand=1, fill=tkinter.tix.BOTH, padx=4, pady=6) - - msg.pack(side=tkinter.tix.TOP, padx=3, pady=3, fill=tkinter.tix.BOTH) - group.pack(side=tkinter.tix.TOP, padx=3, pady=3, fill=tkinter.tix.BOTH) - pane.pack(side=tkinter.tix.TOP, padx=3, pady=3, fill=tkinter.tix.BOTH, expand=1) - -def MkNoteBook(w): - msg = tkinter.tix.Message(w, - relief=tkinter.tix.FLAT, width=240, anchor=tkinter.tix.N, - text='The NoteBook widget allows you to layout a complex interface into individual pages.') - # prefix = Tix.OptionName(w) - # if not prefix: prefix = '' - # w.option_add('*' + prefix + '*TixNoteBook*tagPadX', 8) - options = "entry.width %d label.width %d label.anchor %s" % (10, 18, tkinter.tix.E) - - nb = tkinter.tix.NoteBook(w, ipadx=6, ipady=6, options=options) - nb.add('hard_disk', label="Hard Disk", underline=0) - nb.add('network', label="Network", underline=0) - - # Frame for the buttons that are present on all pages - common = tkinter.tix.Frame(nb.hard_disk) - common.pack(side=tkinter.tix.RIGHT, padx=2, pady=2, fill=tkinter.tix.Y) - CreateCommonButtons(common) - - # Widgets belonging only to this page - a = tkinter.tix.Control(nb.hard_disk, value=12, label='Access Time: ') - w = tkinter.tix.Control(nb.hard_disk, value=400, label='Write Throughput: ') - r = tkinter.tix.Control(nb.hard_disk, value=400, label='Read Throughput: ') - c = tkinter.tix.Control(nb.hard_disk, value=1021, label='Capacity: ') - a.pack(side=tkinter.tix.TOP, padx=20, pady=2) - w.pack(side=tkinter.tix.TOP, padx=20, pady=2) - r.pack(side=tkinter.tix.TOP, padx=20, pady=2) - c.pack(side=tkinter.tix.TOP, padx=20, pady=2) - - common = tkinter.tix.Frame(nb.network) - common.pack(side=tkinter.tix.RIGHT, padx=2, pady=2, fill=tkinter.tix.Y) - CreateCommonButtons(common) - - a = tkinter.tix.Control(nb.network, value=12, label='Access Time: ') - w = tkinter.tix.Control(nb.network, value=400, label='Write Throughput: ') - r = tkinter.tix.Control(nb.network, value=400, label='Read Throughput: ') - c = tkinter.tix.Control(nb.network, value=1021, label='Capacity: ') - u = tkinter.tix.Control(nb.network, value=10, label='Users: ') - a.pack(side=tkinter.tix.TOP, padx=20, pady=2) - w.pack(side=tkinter.tix.TOP, padx=20, pady=2) - r.pack(side=tkinter.tix.TOP, padx=20, pady=2) - c.pack(side=tkinter.tix.TOP, padx=20, pady=2) - u.pack(side=tkinter.tix.TOP, padx=20, pady=2) - - msg.pack(side=tkinter.tix.TOP, padx=3, pady=3, fill=tkinter.tix.BOTH) - nb.pack(side=tkinter.tix.TOP, padx=5, pady=5, fill=tkinter.tix.BOTH, expand=1) - -def CreateCommonButtons(f): - ok = tkinter.tix.Button(f, text='OK', width = 6) - cancel = tkinter.tix.Button(f, text='Cancel', width = 6) - ok.pack(side=tkinter.tix.TOP, padx=2, pady=2) - cancel.pack(side=tkinter.tix.TOP, padx=2, pady=2) - -def MkDirList(nb, name): - w = nb.page(name) - options = "label.padX 4" - - dir = tkinter.tix.LabelFrame(w, label='Tix.DirList', options=options) - fsbox = tkinter.tix.LabelFrame(w, label='Tix.ExFileSelectBox', options=options) - MkDirListWidget(dir.frame) - MkExFileWidget(fsbox.frame) - dir.form(top=0, left=0, right='%40', bottom=-1) - fsbox.form(top=0, left='%40', right=-1, bottom=-1) - -def MkDirListWidget(w): - """The TixDirList widget gives a graphical representation of the file - system directory and makes it easy for the user to choose and access - directories. - """ - msg = tkinter.tix.Message(w, - relief=tkinter.tix.FLAT, width=240, anchor=tkinter.tix.N, - text='The Tix DirList widget gives a graphical representation of the file system directory and makes it easy for the user to choose and access directories.') - dirlist = tkinter.tix.DirList(w, options='hlist.padY 1 hlist.width 25 hlist.height 16') - msg.pack(side=tkinter.tix.TOP, expand=1, fill=tkinter.tix.BOTH, padx=3, pady=3) - dirlist.pack(side=tkinter.tix.TOP, padx=3, pady=3) - -def MkExFileWidget(w): - """The TixExFileSelectBox widget is more user friendly than the Motif - style FileSelectBox. """ - msg = tkinter.tix.Message(w, - relief=tkinter.tix.FLAT, width=240, anchor=tkinter.tix.N, - text='The Tix ExFileSelectBox widget is more user friendly than the Motif style FileSelectBox.') - # There's a bug in the ComboBoxes - the scrolledlistbox is destroyed - box = tkinter.tix.ExFileSelectBox(w, bd=2, relief=tkinter.tix.RAISED) - msg.pack(side=tkinter.tix.TOP, expand=1, fill=tkinter.tix.BOTH, padx=3, pady=3) - box.pack(side=tkinter.tix.TOP, padx=3, pady=3) - -### -### List of all the demos we want to show off -comments = {'widget' : 'Widget Demos', 'image' : 'Image Demos'} -samples = {'Balloon' : 'Balloon', - 'Button Box' : 'BtnBox', - 'Combo Box' : 'ComboBox', - 'Compound Image' : 'CmpImg', - 'Directory List' : 'DirList', - 'Directory Tree' : 'DirTree', - 'Control' : 'Control', - 'Notebook' : 'NoteBook', - 'Option Menu' : 'OptMenu', - 'Paned Window' : 'PanedWin', - 'Popup Menu' : 'PopMenu', - 'ScrolledHList (1)' : 'SHList1', - 'ScrolledHList (2)' : 'SHList2', - 'Tree (dynamic)' : 'Tree' -} - -# There are still a lot of demos to be translated: -## set root { -## {d "File Selectors" file } -## {d "Hierachical ListBox" hlist } -## {d "Tabular ListBox" tlist {c tixTList}} -## {d "Grid Widget" grid {c tixGrid}} -## {d "Manager Widgets" manager } -## {d "Scrolled Widgets" scroll } -## {d "Miscellaneous Widgets" misc } -## {d "Image Types" image } -## } -## -## set image { -## {d "Compound Image" cmpimg } -## {d "XPM Image" xpm {i pixmap}} -## } -## -## set cmpimg { -##done {f "In Buttons" CmpImg.tcl } -## {f "In NoteBook" CmpImg2.tcl } -## {f "Notebook Color Tabs" CmpImg4.tcl } -## {f "Icons" CmpImg3.tcl } -## } -## -## set xpm { -## {f "In Button" Xpm.tcl {i pixmap}} -## {f "In Menu" Xpm1.tcl {i pixmap}} -## } -## -## set file { -##added {f DirList DirList.tcl } -##added {f DirTree DirTree.tcl } -## {f DirSelectDialog DirDlg.tcl } -## {f ExFileSelectDialog EFileDlg.tcl } -## {f FileSelectDialog FileDlg.tcl } -## {f FileEntry FileEnt.tcl } -## } -## -## set hlist { -## {f HList HList1.tcl } -## {f CheckList ChkList.tcl {c tixCheckList}} -##done {f "ScrolledHList (1)" SHList.tcl } -##done {f "ScrolledHList (2)" SHList2.tcl } -##done {f Tree Tree.tcl } -##done {f "Tree (Dynamic)" DynTree.tcl {v win}} -## } -## -## set tlist { -## {f "ScrolledTList (1)" STList1.tcl {c tixTList}} -## {f "ScrolledTList (2)" STList2.tcl {c tixTList}} -## } -## global tcl_platform -## # This demo hangs windows -## if {$tcl_platform(platform) != "windows"} { -##na lappend tlist {f "TList File Viewer" STList3.tcl {c tixTList}} -## } -## -## set grid { -##na {f "Simple Grid" SGrid0.tcl {c tixGrid}} -##na {f "ScrolledGrid" SGrid1.tcl {c tixGrid}} -##na {f "Editable Grid" EditGrid.tcl {c tixGrid}} -## } -## -## set scroll { -## {f ScrolledListBox SListBox.tcl } -## {f ScrolledText SText.tcl } -## {f ScrolledWindow SWindow.tcl } -##na {f "Canvas Object View" CObjView.tcl {c tixCObjView}} -## } -## -## set manager { -## {f ListNoteBook ListNBK.tcl } -##done {f NoteBook NoteBook.tcl } -##done {f PanedWindow PanedWin.tcl } -## } -## -## set misc { -##done {f Balloon Balloon.tcl } -##done {f ButtonBox BtnBox.tcl } -##done {f ComboBox ComboBox.tcl } -##done {f Control Control.tcl } -## {f LabelEntry LabEntry.tcl } -## {f LabelFrame LabFrame.tcl } -## {f Meter Meter.tcl {c tixMeter}} -##done {f OptionMenu OptMenu.tcl } -##done {f PopupMenu PopMenu.tcl } -## {f Select Select.tcl } -## {f StdButtonBox StdBBox.tcl } -## } -## - -stypes = {} -stypes['widget'] = ['Balloon', 'Button Box', 'Combo Box', 'Control', - 'Directory List', 'Directory Tree', - 'Notebook', 'Option Menu', 'Popup Menu', 'Paned Window', - 'ScrolledHList (1)', 'ScrolledHList (2)', 'Tree (dynamic)'] -stypes['image'] = ['Compound Image'] - -def MkSample(nb, name): - w = nb.page(name) - options = "label.padX 4" - - pane = tkinter.tix.PanedWindow(w, orientation='horizontal') - pane.pack(side=tkinter.tix.TOP, expand=1, fill=tkinter.tix.BOTH) - f1 = pane.add('list', expand='1') - f2 = pane.add('text', expand='5') - f1['relief'] = 'flat' - f2['relief'] = 'flat' - - lab = tkinter.tix.LabelFrame(f1, label='Select a sample program:') - lab.pack(side=tkinter.tix.TOP, expand=1, fill=tkinter.tix.BOTH, padx=5, pady=5) - lab1 = tkinter.tix.LabelFrame(f2, label='Source:') - lab1.pack(side=tkinter.tix.TOP, expand=1, fill=tkinter.tix.BOTH, padx=5, pady=5) - - slb = tkinter.tix.Tree(lab.frame, options='hlist.width 20') - slb.pack(side=tkinter.tix.TOP, expand=1, fill=tkinter.tix.BOTH, padx=5) - - stext = tkinter.tix.ScrolledText(lab1.frame, name='stext') - font = root.tk.eval('tix option get fixed_font') - stext.text.config(font=font) - - frame = tkinter.tix.Frame(lab1.frame, name='frame') - - run = tkinter.tix.Button(frame, text='Run ...', name='run') - view = tkinter.tix.Button(frame, text='View Source ...', name='view') - run.pack(side=tkinter.tix.LEFT, expand=0, fill=tkinter.tix.NONE) - view.pack(side=tkinter.tix.LEFT, expand=0, fill=tkinter.tix.NONE) - - stext.text['bg'] = slb.hlist['bg'] - stext.text['state'] = 'disabled' - stext.text['wrap'] = 'none' - stext.text['width'] = 80 - - frame.pack(side=tkinter.tix.BOTTOM, expand=0, fill=tkinter.tix.X, padx=7) - stext.pack(side=tkinter.tix.TOP, expand=0, fill=tkinter.tix.BOTH, padx=7) - - slb.hlist['separator'] = '.' - slb.hlist['width'] = 25 - slb.hlist['drawbranch'] = 0 - slb.hlist['indent'] = 10 - slb.hlist['wideselect'] = 1 - slb.hlist['command'] = lambda args=0, w=w,slb=slb,stext=stext,run=run,view=view: Sample_Action(w, slb, stext, run, view, 'run') - slb.hlist['browsecmd'] = lambda args=0, w=w,slb=slb,stext=stext,run=run,view=view: Sample_Action(w, slb, stext, run, view, 'browse') - - run['command'] = lambda args=0, w=w,slb=slb,stext=stext,run=run,view=view: Sample_Action(w, slb, stext, run, view, 'run') - view['command'] = lambda args=0, w=w,slb=slb,stext=stext,run=run,view=view: Sample_Action(w, slb, stext, run, view, 'view') - - for type in ['widget', 'image']: - if type != 'widget': - x = tkinter.tix.Frame(slb.hlist, bd=2, height=2, width=150, - relief=tkinter.tix.SUNKEN, bg=slb.hlist['bg']) - slb.hlist.add_child(itemtype=tkinter.tix.WINDOW, window=x, state='disabled') - x = slb.hlist.add_child(itemtype=tkinter.tix.TEXT, state='disabled', - text=comments[type]) - for key in stypes[type]: - slb.hlist.add_child(x, itemtype=tkinter.tix.TEXT, data=key, - text=key) - slb.hlist.selection_clear() - - run['state'] = 'disabled' - view['state'] = 'disabled' - -def Sample_Action(w, slb, stext, run, view, action): - global demo - - hlist = slb.hlist - anchor = hlist.info_anchor() - if not anchor: - run['state'] = 'disabled' - view['state'] = 'disabled' - elif not hlist.info_parent(anchor): - # a comment - return - - run['state'] = 'normal' - view['state'] = 'normal' - key = hlist.info_data(anchor) - title = key - prog = samples[key] - - if action == 'run': - exec('import ' + prog) - w = tkinter.tix.Toplevel() - w.title(title) - rtn = eval(prog + '.RunSample') - rtn(w) - elif action == 'view': - w = tkinter.tix.Toplevel() - w.title('Source view: ' + title) - LoadFile(w, demo.dir + '/samples/' + prog + '.py') - elif action == 'browse': - ReadFile(stext.text, demo.dir + '/samples/' + prog + '.py') - -def LoadFile(w, fname): - global root - b = tkinter.tix.Button(w, text='Close', command=w.destroy) - t = tkinter.tix.ScrolledText(w) - # b.form(left=0, bottom=0, padx=4, pady=4) - # t.form(left=0, bottom=b, right='-0', top=0) - t.pack() - b.pack() - - font = root.tk.eval('tix option get fixed_font') - t.text.config(font=font) - t.text['bd'] = 2 - t.text['wrap'] = 'none' - - ReadFile(t.text, fname) - -def ReadFile(w, fname): - old_state = w['state'] - w['state'] = 'normal' - w.delete('0.0', tkinter.tix.END) - - try: - f = open(fname) - lines = f.readlines() - for s in lines: - w.insert(tkinter.tix.END, s) - f.close() - finally: -# w.see('1.0') - w['state'] = old_state - -if __name__ == '__main__': - root = tkinter.tix.Tk() - RunMain(root) |