From b21cb5fa7d4e820d470a4dc5a80544e0e0965c86 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Wed, 21 Mar 2001 07:42:07 +0000 Subject: [PATCH] Patch #410231: Add the Python Tix library. --- Demo/tix/BUGS.txt | 8 + Demo/tix/INSTALL.txt | 81 ++ Demo/tix/README.txt | 19 + Demo/tix/bitmaps/about.xpm | 50 ++ Demo/tix/bitmaps/bold.xbm | 6 + Demo/tix/bitmaps/capital.xbm | 6 + Demo/tix/bitmaps/centerj.xbm | 6 + Demo/tix/bitmaps/combobox.xbm | 14 + Demo/tix/bitmaps/combobox.xpm | 49 ++ Demo/tix/bitmaps/combobox.xpm.1 | 47 ++ Demo/tix/bitmaps/drivea.xbm | 14 + Demo/tix/bitmaps/drivea.xpm | 43 ++ Demo/tix/bitmaps/exit.xpm | 48 ++ Demo/tix/bitmaps/filebox.xbm | 14 + Demo/tix/bitmaps/filebox.xpm | 49 ++ Demo/tix/bitmaps/italic.xbm | 6 + Demo/tix/bitmaps/justify.xbm | 6 + Demo/tix/bitmaps/leftj.xbm | 6 + Demo/tix/bitmaps/netw.xbm | 14 + Demo/tix/bitmaps/netw.xpm | 45 ++ Demo/tix/bitmaps/optmenu.xpm | 48 ++ Demo/tix/bitmaps/rightj.xbm | 6 + Demo/tix/bitmaps/select.xpm | 52 ++ Demo/tix/bitmaps/tix.gif | Bin 0 -> 11042 bytes Demo/tix/bitmaps/underline.xbm | 6 + Demo/tix/samples/Balloon.py | 45 ++ Demo/tix/samples/BtnBox.py | 44 ++ Demo/tix/samples/CmpImg.py | 197 +++++ Demo/tix/samples/ComboBox.py | 100 +++ Demo/tix/samples/Control.py | 102 +++ Demo/tix/samples/NoteBook.py | 119 +++ Demo/tix/samples/OptMenu.py | 68 ++ Demo/tix/samples/PopMenu.py | 56 ++ Demo/tix/samples/SHList1.py | 107 +++ Demo/tix/samples/SHList2.py | 148 ++++ Demo/tix/samples/Tree.py | 80 ++ Demo/tix/tixwidgets.py | 819 ++++++++++++++++++++ Lib/lib-tk/Tix.py | 1266 +++++++++++++++++++++++++++++++ 38 files changed, 3794 insertions(+) create mode 100644 Demo/tix/BUGS.txt create mode 100644 Demo/tix/INSTALL.txt create mode 100644 Demo/tix/README.txt create mode 100755 Demo/tix/bitmaps/about.xpm create mode 100755 Demo/tix/bitmaps/bold.xbm create mode 100755 Demo/tix/bitmaps/capital.xbm create mode 100755 Demo/tix/bitmaps/centerj.xbm create mode 100755 Demo/tix/bitmaps/combobox.xbm create mode 100755 Demo/tix/bitmaps/combobox.xpm create mode 100755 Demo/tix/bitmaps/combobox.xpm.1 create mode 100755 Demo/tix/bitmaps/drivea.xbm create mode 100755 Demo/tix/bitmaps/drivea.xpm create mode 100755 Demo/tix/bitmaps/exit.xpm create mode 100755 Demo/tix/bitmaps/filebox.xbm create mode 100755 Demo/tix/bitmaps/filebox.xpm create mode 100755 Demo/tix/bitmaps/italic.xbm create mode 100755 Demo/tix/bitmaps/justify.xbm create mode 100755 Demo/tix/bitmaps/leftj.xbm create mode 100755 Demo/tix/bitmaps/netw.xbm create mode 100755 Demo/tix/bitmaps/netw.xpm create mode 100755 Demo/tix/bitmaps/optmenu.xpm create mode 100755 Demo/tix/bitmaps/rightj.xbm create mode 100755 Demo/tix/bitmaps/select.xpm create mode 100755 Demo/tix/bitmaps/tix.gif create mode 100755 Demo/tix/bitmaps/underline.xbm create mode 100755 Demo/tix/samples/Balloon.py create mode 100755 Demo/tix/samples/BtnBox.py create mode 100755 Demo/tix/samples/CmpImg.py create mode 100755 Demo/tix/samples/ComboBox.py create mode 100755 Demo/tix/samples/Control.py create mode 100755 Demo/tix/samples/NoteBook.py create mode 100755 Demo/tix/samples/OptMenu.py create mode 100755 Demo/tix/samples/PopMenu.py create mode 100755 Demo/tix/samples/SHList1.py create mode 100755 Demo/tix/samples/SHList2.py create mode 100755 Demo/tix/samples/Tree.py create mode 100644 Demo/tix/tixwidgets.py create mode 100755 Lib/lib-tk/Tix.py diff --git a/Demo/tix/BUGS.txt b/Demo/tix/BUGS.txt new file mode 100644 index 0000000000..052a1e634f --- /dev/null +++ b/Demo/tix/BUGS.txt @@ -0,0 +1,8 @@ +$Id$ + +1) There seems to be a problem with ComboBox that shows up +in the ExFileSelectBox demo. The popdown scrolled list widget +is being created, then destroyed. This does not happen in Tcl Tix. +This is probably a sympton in Tix from _tkinter; if you find the cause +of this, please post a patch on http://tix.sourceforge.net. + diff --git a/Demo/tix/INSTALL.txt b/Demo/tix/INSTALL.txt new file mode 100644 index 0000000000..9dc3093c50 --- /dev/null +++ b/Demo/tix/INSTALL.txt @@ -0,0 +1,81 @@ +$Id$ + +Installing PyTix +---------------- + +0) To use PyTix, you need Tcl/Tk (V8.2+), Tix (V8.1+) and Python (V2.1+). + PyTix 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 PyTix 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.2 or 8.3. Build and install Tix 8.1 or better. + 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.2.3 for this release of PyTix. + +2) Modify Modules/Setup.dist and setup.py to change the version of the + tix library from tix4.1.8.0 to tix8.1.8.2 + 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.2 \ +# *** Uncomment and edit to reflect your Tcl/Tk versions: + -ltk8.2 -ltcl8.2 \ +# *** 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.2 \ + TK_LIBRARY=/usr/local/lib/tk8.2 \ + 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 new file mode 100644 index 0000000000..15e85cd265 --- /dev/null +++ b/Demo/tix/README.txt @@ -0,0 +1,19 @@ +About PyTix +----------- + +PyTix 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 new file mode 100755 index 0000000000..33ffcc06ef --- /dev/null +++ b/Demo/tix/bitmaps/about.xpm @@ -0,0 +1,50 @@ +/* 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 new file mode 100755 index 0000000000..ebff8d1178 --- /dev/null +++ b/Demo/tix/bitmaps/bold.xbm @@ -0,0 +1,6 @@ +#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 new file mode 100755 index 0000000000..fb4e0703b1 --- /dev/null +++ b/Demo/tix/bitmaps/capital.xbm @@ -0,0 +1,6 @@ +#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 new file mode 100755 index 0000000000..9d2c064834 --- /dev/null +++ b/Demo/tix/bitmaps/centerj.xbm @@ -0,0 +1,6 @@ +#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 new file mode 100755 index 0000000000..f5947f57b4 --- /dev/null +++ b/Demo/tix/bitmaps/combobox.xbm @@ -0,0 +1,14 @@ +#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 new file mode 100755 index 0000000000..d0234ab8e2 --- /dev/null +++ b/Demo/tix/bitmaps/combobox.xpm @@ -0,0 +1,49 @@ +/* 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 new file mode 100755 index 0000000000..63792a4908 --- /dev/null +++ b/Demo/tix/bitmaps/combobox.xpm.1 @@ -0,0 +1,47 @@ +/* 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 new file mode 100755 index 0000000000..83c636c670 --- /dev/null +++ b/Demo/tix/bitmaps/drivea.xbm @@ -0,0 +1,14 @@ +#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 new file mode 100755 index 0000000000..4d274b995f --- /dev/null +++ b/Demo/tix/bitmaps/drivea.xpm @@ -0,0 +1,43 @@ +/* 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 new file mode 100755 index 0000000000..505a07bdf6 --- /dev/null +++ b/Demo/tix/bitmaps/exit.xpm @@ -0,0 +1,48 @@ +/* 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 new file mode 100755 index 0000000000..c8f7ac255b --- /dev/null +++ b/Demo/tix/bitmaps/filebox.xbm @@ -0,0 +1,14 @@ +#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 new file mode 100755 index 0000000000..7377ee60e6 --- /dev/null +++ b/Demo/tix/bitmaps/filebox.xpm @@ -0,0 +1,49 @@ +/* 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 new file mode 100755 index 0000000000..169c3cb75f --- /dev/null +++ b/Demo/tix/bitmaps/italic.xbm @@ -0,0 +1,6 @@ +#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 new file mode 100755 index 0000000000..bba660acec --- /dev/null +++ b/Demo/tix/bitmaps/justify.xbm @@ -0,0 +1,6 @@ +#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 new file mode 100755 index 0000000000..5f8e006f4e --- /dev/null +++ b/Demo/tix/bitmaps/leftj.xbm @@ -0,0 +1,6 @@ +#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 new file mode 100755 index 0000000000..a684d65d4b --- /dev/null +++ b/Demo/tix/bitmaps/netw.xbm @@ -0,0 +1,14 @@ +#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 new file mode 100755 index 0000000000..fff6593bca --- /dev/null +++ b/Demo/tix/bitmaps/netw.xpm @@ -0,0 +1,45 @@ +/* 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 new file mode 100755 index 0000000000..63bab81299 --- /dev/null +++ b/Demo/tix/bitmaps/optmenu.xpm @@ -0,0 +1,48 @@ +/* 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 new file mode 100755 index 0000000000..1d438e0090 --- /dev/null +++ b/Demo/tix/bitmaps/rightj.xbm @@ -0,0 +1,6 @@ +#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 new file mode 100755 index 0000000000..392e5a0834 --- /dev/null +++ b/Demo/tix/bitmaps/select.xpm @@ -0,0 +1,52 @@ +/* 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 new file mode 100755 index 0000000000000000000000000000000000000000..e7d51a086cc20c9a402e953237850ffba4d81844 GIT binary patch literal 11042 zcmV+-E8WybNk%v~Vf+Bq0OJ4v00030|Nj60{{R4j{{R4jf`b450D=Gj!^6V>f&hYo z009300D^)50000000000EC2ui0Q>;e06+x)5XecZy*TU5yZ>M)j$~;DXo?Q$AfUn< z&v6jD^lZ<#(9?sUa7c6seZkw!m^==VOk8oATvD&WfYZk{cDcD67D(1<$Wf!pIG_YL)C7%{D`W8( z#sL5WSt^{Z)(tT*a^T1Ua6%RsXrQT60tP~&kQ%@MQWXZ=WDQVo;8dt!nS!+%)#=l+ zW}OyDo3&}xrUVWYTsoFuS*UBFrX98@Q{wRGDQZTr4;>vVP6h6g~0)=ay0<^g6`3kV!|6Tinn-;Hv! z>_+2my@X?-JV35x%eABLeQmd(YU$YBVlCZJ?A`3(QJmi0^bz4-vWlG7sf_Uo;FHih zp$zqa{kQ`U+!bp*YG$@jVWt=VSOQk}+<)NFW?E}05){UJhxA9s;p85E#4dlqI=vV!VN1#Tx8#uV1_B?m|`kmfSC%UiDrQMS;rTG zxt*3^bY2|^rc?T{m8SuF^4V0H2d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MA)ZAmI;sNp+5rFq!QLi*HTpbTp=wjf%SNXS3!LwNB{^m}vl_X%e%Du|}B-Xcs%7y}LeZ zQ9`eNc!lUYv^ZP~Vt_eQX6F;clR`G>vtDh~?q|(j#|IvPwMGF3z|VPj?Y*Ww&9D!` zHpWvRZNmd?5KQfINNbpO+7Ju|_U#NZz->(YyWu?F<$=%NhFe0mVB#k3Or(x+{UhaJ zDsoImm5gBOsA$DIlM(z9g3NCJ_C{vrWLxcCZ$ArdfjB(5OgQtFuP@lYrfqNkhDm?$ zhJ=M}lW`EFaHgpcWjj2$Z%c3WHtjex=l_oITDXk(+J&s+R;kc%FEP?GQ4L!Qji|gs z(GJHWNa|w-aAf|_0k@o5OKvm}yul6-0v}#BbwcEFjQJLj4N&JcZSnkeO3j?`PVf&1 zKT+le%^QEB3zyRYqAMT&I_zWb497Z21@a&MEs@AvP&SJk{&04-k%d%8DF2c;op3Z~ zZ}1l5ze_J9yuXYdY!78~3o&ynPjlqP^X&ex0H?JUDp}jka})@->z;9^TJ!kUb1om> z5<88>8*@cZ4;cyWVU*z4O7Z;Ol3wi?;QbJ*=OdS{sU4!zutp*22>fjymixw4F|GKFX3MRdT_`vjC zm=R(I?_y>$T_fZ{Yp+Qs0VTyT;4KVhzrN3usZ2=$N)e2f^7ee-gU+N+DFPLD&j%o2 zxLoIlZAafyY8FtLE%5MSvIq-x_x3?Xu#5hQepiKuIrn!D_}L0= 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: + # Works here though. Why ? Beats me. + return maker_list[0] + # Works here though. Why ? Beats me. + return maker_list[i] + +def ok_command(w): + print "Selected", demo_num_engines.get(), "of", demo_maker.get(), " engines each of thrust", demo_thrust.get() + w.destroy() + +if __name__ == '__main__': + root = Tix.Tk() + RunSample(root) + root.mainloop() diff --git a/Demo/tix/samples/NoteBook.py b/Demo/tix/samples/NoteBook.py new file mode 100755 index 0000000000..993dcc6c31 --- /dev/null +++ b/Demo/tix/samples/NoteBook.py @@ -0,0 +1,119 @@ +#!/usr/local/bin/python +# +# $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": 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 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 = 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', 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 = 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=Tix.BOTH, padx=5, pady=5 ,side=Tix.TOP) + + #---------------------------------------- + # Create the first page + #---------------------------------------- + # Create two frames: one for the common buttons, one for the + # other widgets + # + tab=nb.hard_disk + f = Tix.Frame(tab) + common = Tix.Frame(tab) + + f.pack(side=Tix.LEFT, padx=2, pady=2, fill=Tix.BOTH, expand=1) + common.pack(side=Tix.RIGHT, padx=2, fill=Tix.Y) + + a = Tix.Control(f, value=12, label='Access time: ') + w = Tix.Control(f, value=400, label='Write Throughput: ') + r = Tix.Control(f, value=400, label='Read Throughput: ') + c = Tix.Control(f, value=1021, label='Capacity: ') + + a.pack(side=Tix.TOP, padx=20, pady=2) + w.pack(side=Tix.TOP, padx=20, pady=2) + r.pack(side=Tix.TOP, padx=20, pady=2) + c.pack(side=Tix.TOP, padx=20, pady=2) + + # Create the common buttons + createCommonButtons(common) + + #---------------------------------------- + # Create the second page + #---------------------------------------- + + tab = nb.network + + f = Tix.Frame(tab) + common = Tix.Frame(tab) + + f.pack(side=Tix.LEFT, padx=2, pady=2, fill=Tix.BOTH, expand=1) + common.pack(side=Tix.RIGHT, padx=2, fill=Tix.Y) + + a = Tix.Control(f, value=12, label='Access time: ') + w = Tix.Control(f, value=400, label='Write Throughput: ') + r = Tix.Control(f, value=400, label='Read Throughput: ') + c = Tix.Control(f, value=1021, label='Capacity: ') + u = Tix.Control(f, value=10, label='Users: ') + + a.pack(side=Tix.TOP, padx=20, pady=2) + w.pack(side=Tix.TOP, padx=20, pady=2) + r.pack(side=Tix.TOP, padx=20, pady=2) + c.pack(side=Tix.TOP, padx=20, pady=2) + u.pack(side=Tix.TOP, padx=20, pady=2) + + createCommonButtons(common) + +def doDestroy(): + global root + root.destroy() + +def createCommonButtons(master): + ok = Tix.Button(master, name='ok', text='OK', width=6, + command=doDestroy) + cancel = Tix.Button(master, name='cancel', + text='Cancel', width=6, + command=doDestroy) + + ok.pack(side=Tix.TOP, padx=2, pady=2) + cancel.pack(side=Tix.TOP, padx=2, pady=2) + +if __name__ == '__main__': + root = Tix.Tk() + RunSample(root) + root.mainloop() diff --git a/Demo/tix/samples/OptMenu.py b/Demo/tix/samples/OptMenu.py new file mode 100755 index 0000000000..2d05938372 --- /dev/null +++ b/Demo/tix/samples/OptMenu.py @@ -0,0 +1,68 @@ +#!/usr/local/bin/python +# +# $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": 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 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 = Tix.StringVar() + demo_opt_to = Tix.StringVar() + + top = Tix.Frame(w, bd=1, relief=Tix.RAISED) + + from_file = Tix.OptionMenu(top, label="From File Format : ", + variable=demo_opt_from, + options = 'label.width 19 label.anchor e menubutton.width 15') + + to_file = 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=Tix.TOP, anchor=Tix.W, pady=3, padx=6) + to_file.pack(side=Tix.TOP, anchor=Tix.W, pady=3, padx=6) + + box = Tix.ButtonBox(w, orientation=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=Tix.BOTTOM, fill=Tix.X) + top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1) + +def ok_command(w): + print "Convert file from", demo_opt_from.get(), " to", demo_opt_to.get() + w.destroy() + +if __name__ == '__main__': + root = Tix.Tk() + RunSample(root) + root.mainloop() diff --git a/Demo/tix/samples/PopMenu.py b/Demo/tix/samples/PopMenu.py new file mode 100755 index 0000000000..c2301cf78c --- /dev/null +++ b/Demo/tix/samples/PopMenu.py @@ -0,0 +1,56 @@ +# Tix Demostration Program +# +# $Id$ +# +# +# This sample program is structured in such a way so that it can be +# executed from the Tix demo program "widget": 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 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 = Tix.Frame(w, relief=Tix.RAISED, bd=1) + but = Tix.Button(top, text='Press the right mouse button over this button or its surrounding area') + but.pack(expand=1, fill=Tix.BOTH, padx=50, pady=50) + + p = 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 = Tix.Menu(p.menu) + m1.add_command(label='Hello') + p.menu.add_cascade(label='More', menu=m1) + + but.pack(side=Tix.TOP, padx=40, pady=50) + + box = Tix.ButtonBox(w, orientation=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=Tix.BOTTOM, fill=Tix.X) + top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1) + +if __name__ == '__main__': + root = Tix.Tk() + RunSample(root) + root.mainloop() diff --git a/Demo/tix/samples/SHList1.py b/Demo/tix/samples/SHList1.py new file mode 100755 index 0000000000..5122bbcdda --- /dev/null +++ b/Demo/tix/samples/SHList1.py @@ -0,0 +1,107 @@ +#!/usr/local/bin/python +# +# $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": 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 Tix + +def RunSample (w) : + + # We create the frame and the ScrolledHList widget + # at the top of the dialog box + # + top = Tix.Frame( w, relief=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 = Tix.ScrolledHList(top) + top.a.pack( expand=1, fill=Tix.BOTH, padx=10, pady=10, side=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=Tix.Frame(hlist, name='sep%d' % count, height=2, width=150, + bd=2, relief=Tix.SUNKEN, bg=hlist['bg'] ) + + hlist.add_child( itemtype=Tix.WINDOW, + window=f, state=Tix.DISABLED ) + + hlist.add(boss, itemtype=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= Tix.ButtonBox(top, orientation=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=Tix.BOTTOM, fill=Tix.X) + top.pack( side=Tix.TOP, fill=Tix.BOTH, expand=1 ) + + +# This "if" statement makes it possible to run this script file inside or +# outside of the main demo program "widget". +# +if __name__== '__main__' : + root=Tix.Tk() + RunSample(root) + root.mainloop() diff --git a/Demo/tix/samples/SHList2.py b/Demo/tix/samples/SHList2.py new file mode 100755 index 0000000000..e1a7a7c21b --- /dev/null +++ b/Demo/tix/samples/SHList2.py @@ -0,0 +1,148 @@ +#!/usr/local/bin/python +# +# $Id$ +# +# Tix Demostration Program +# +# This sample program is structured in such a way so that it can be +# executed from the PyTix 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 Tix + +def RunSample (w) : + + # We create the frame and the ScrolledHList widget + # at the top of the dialog box + # + top = Tix.Frame( w, relief=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 = Tix.ScrolledHList(top, options='hlist.columns 3 hlist.header 1' ) + + top.a.pack( expand=1, fill=Tix.BOTH, padx=10, pady=10, side=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'] = Tix.DisplayStyle(Tix.TEXT, fg='black', refwindow=top, + anchor=Tix.CENTER, padx=8, pady=2, font = boldfont ) + + hlist.header_create(0, itemtype=Tix.TEXT, text='Name', + style=style['header']) + hlist.header_create(1, itemtype=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'] = Tix.DisplayStyle(Tix.TEXT, refwindow=top, + fg='#202060', selectforeground = '#202060', font = boldfont ) + + style['mgr_posn'] = Tix.DisplayStyle(Tix.TEXT, padx=8, refwindow=top, + fg='#202060', selectforeground='#202060' ) + + style['empl_name'] = Tix.DisplayStyle(Tix.TEXT, refwindow=top, + fg='#602020', selectforeground = '#602020', font = boldfont ) + + style['empl_posn'] = Tix.DisplayStyle(Tix.TEXT, padx=8, refwindow=top, + fg='#602020', selectforeground = '#602020' ) + + # 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=Tix.TEXT, text=boss[1], + style=style['mgr_name']) + hlist.item_create('.', 1, itemtype=Tix.TEXT, text=boss[2], + style=style['mgr_posn']) + + # Create the managers + # + + for key,name,posn in managers : + e= '.'+ key + hlist.add(e, itemtype=Tix.TEXT, text=name, + style=style['mgr_name']) + hlist.item_create(e, 1, itemtype=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=Tix.TEXT, + text = posn, style = style['empl_posn'] ) + + + # Use a ButtonBox to hold the buttons. + # + box= Tix.ButtonBox(top, orientation=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=Tix.BOTTOM, fill=Tix.X) + top.pack( side=Tix.TOP, fill=Tix.BOTH, expand=1 ) + + +# This "if" statement makes it possible to run this script file inside or +# outside of the main demo program "widget". +# +if __name__== '__main__' : + root=Tix.Tk() + RunSample(root) + root.mainloop() diff --git a/Demo/tix/samples/Tree.py b/Demo/tix/samples/Tree.py new file mode 100755 index 0000000000..b0520fbba5 --- /dev/null +++ b/Demo/tix/samples/Tree.py @@ -0,0 +1,80 @@ +#!/usr/local/bin/python +# +# $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": 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 Tix, os + +def RunSample(w): + top = Tix.Frame(w, relief=Tix.RAISED, bd=1) + tree = Tix.Tree(top, options='separator "/"') + tree.pack(expand=1, fill=Tix.BOTH, padx=10, pady=10, side=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 = Tix.ButtonBox(w, orientation=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=Tix.BOTTOM, fill=Tix.X) + top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1) + +def adddir(tree, dir): + if dir == '/': + text = '/' + else: + text = os.path.basename(dir) + tree.hlist.add(dir, itemtype=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=Tix.IMAGETEXT, text=file, + image=tree.tk.call('tix', 'getimage', 'file')) + +if __name__ == '__main__': + root = Tix.Tk() + RunSample(root) + root.mainloop() diff --git a/Demo/tix/tixwidgets.py b/Demo/tix/tixwidgets.py new file mode 100644 index 0000000000..b2873648d8 --- /dev/null +++ b/Demo/tix/tixwidgets.py @@ -0,0 +1,819 @@ +#! /usr/local/bin/python +# +# $Id$ +# +# tixwidgets.py -- +# This is a demo program of all Tix widgets available from Python. If +# you have installed Python & Tix properly, you can execute this as +# +# % tixwidget.py +# + +import os, sys, Tix + +class Demo: + pass + +root = Tix.Tk() + +demo = Demo() +demo.dir = None # script directory +demo.balloon = None # balloon widget +demo.useBalloons = Tix.StringVar() +demo.useBalloons.set('0') +demo.statusbar = None # status bar widget +demo.welmsg = None # Msg widget +demo.welfont = '' # font name +demo.welsize = '' # font size + +def main(): + global demo, root + + progname = sys.argv[0] + dirname = os.path.dirname(progname) + if dirname and dirname != os.curdir: + demo.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: + demo.dir = os.getcwd() + sys.path.insert(0, demo.dir+'/samples') + + root.withdraw() + root = Tix.Toplevel() + root.title('Tix Widget Demonstration') + root.geometry('780x570+50+50') + + demo.balloon = Tix.Balloon(root) + frame1 = MkMainMenu(root) + frame2 = MkMainNotebook(root) + frame3 = MkMainStatus(root) + frame1.pack(side=Tix.TOP, fill=Tix.X) + frame3.pack(side=Tix.BOTTOM, fill=Tix.X) + frame2.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=4, pady=4) + demo.balloon['statusbar'] = demo.statusbar + root.mainloop() + +def exit_cmd(event=None): + sys.exit() + +def MkMainMenu(top): + global demo + + w = Tix.Frame(top, bd=2, relief=Tix.RAISED) + file = Tix.Menubutton(w, text='File', underline=0, takefocus=0) + help = Tix.Menubutton(w, text='Help', underline=0, takefocus=0) + file.pack(side=Tix.LEFT) + help.pack(side=Tix.RIGHT) + fm = Tix.Menu(file) + file['menu'] = fm + hm = Tix.Menu(help) + help['menu'] = hm + + fm.add_command(label='Exit', underline=1, accelerator='Ctrl+X', + command=exit_cmd) + hm.add_checkbutton(label='BalloonHelp', underline=0, command=ToggleHelp, + variable=demo.useBalloons) + # The trace variable option doesn't seem to work, instead I use 'command' + #apply(w.tk.call, ('trace', 'variable', demo.useBalloons, 'w', + # ToggleHelp)) + top.bind_all("", exit_cmd) + top.bind_all("", exit_cmd) + return w + +def MkMainNotebook(top): + top.option_add('*TixNoteBook*tagPadX', 6) + top.option_add('*TixNoteBook*tagPadY', 4) + top.option_add('*TixNoteBook*borderWidth', 2) + top.option_add('*TixNoteBook*font', + '-*-helvetica-bold-o-normal-*-14-*-*-*-*-*-*-*') + w = Tix.NoteBook(top, ipadx=5, ipady=5) + 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(top): + global demo + + w = Tix.Frame(top, relief=Tix.RAISED, bd=1) + demo.statusbar = Tix.Label(w, relief=Tix.SUNKEN, bd=1, font='-*-helvetica-medium-r-normal-*-14-*-*-*-*-*-*-*') + demo.statusbar.form(padx=3, pady=3, left=0, right='%70') + return w + +def MkWelcome(nb, name): + w = nb.page(name) + bar = MkWelcomeBar(w) + text = MkWelcomeText(w) + bar.pack(side=Tix.TOP, fill=Tix.X, padx=2, pady=2) + text.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1) + +def MkWelcomeBar(top): + global demo + + w = Tix.Frame(top, bd=2, relief=Tix.GROOVE) + b1 = Tix.ComboBox(w, command=lambda w=top: MainTextFont(w)) + b2 = 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(Tix.END, 'Courier') + b1.insert(Tix.END, 'Helvetica') + b1.insert(Tix.END, 'Lucida') + b1.insert(Tix.END, 'Times Roman') + + b2.insert(Tix.END, '8') + b2.insert(Tix.END, '10') + b2.insert(Tix.END, '12') + b2.insert(Tix.END, '14') + b2.insert(Tix.END, '18') + + b1.pick(1) + b2.pick(3) + + b1.pack(side=Tix.LEFT, padx=4, pady=4) + b2.pack(side=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 = Tix.ScrolledWindow(top, scrollbar='auto') + win = w.window + text = 'Welcome to TIX in Python' + title = Tix.Label(win, font='-*-times-bold-r-normal-*-18-*-*-*-*-*-*-*', + bd=0, width=30, anchor=Tix.N, text=text) + msg = Tix.Message(win, font='-*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*', + bd=0, width=400, anchor=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=Tix.BOTH, padx=10, pady=10) + msg.pack(expand=1, fill=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-bold-r-normal-*-%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) + prefix = Tix.OptionName(w) + if not prefix: + prefix = '' + w.option_add('*' + prefix + '*TixLabelFrame*label.padX', 4) + + til = Tix.LabelFrame(w, label='Chooser Widgets') + cbx = Tix.LabelFrame(w, label='tixComboBox') + ctl = Tix.LabelFrame(w, label='tixControl') + sel = Tix.LabelFrame(w, label='tixSelect') + opt = Tix.LabelFrame(w, label='tixOptionMenu') + fil = Tix.LabelFrame(w, label='tixFileEntry') + fbx = Tix.LabelFrame(w, label='tixFileSelectBox') + tbr = Tix.LabelFrame(w, label='Tool Bar') + + 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): + prefix = Tix.OptionName(w) + if not prefix: prefix = '' + w.option_add('*' + prefix + '*TixComboBox*label.width', 10) + w.option_add('*' + prefix + '*TixComboBox*label.anchor', Tix.E) + w.option_add('*' + prefix + '*TixComboBox*entry.width', 14) + + static = Tix.ComboBox(w, label='Static', editable=0) + editable = Tix.ComboBox(w, label='Editable', editable=1) + history = Tix.ComboBox(w, label='History', editable=1, history=1, + anchor=Tix.E) + static.insert(Tix.END, 'January') + static.insert(Tix.END, 'February') + static.insert(Tix.END, 'March') + static.insert(Tix.END, 'April') + static.insert(Tix.END, 'May') + static.insert(Tix.END, 'June') + static.insert(Tix.END, 'July') + static.insert(Tix.END, 'August') + static.insert(Tix.END, 'September') + static.insert(Tix.END, 'October') + static.insert(Tix.END, 'November') + static.insert(Tix.END, 'December') + + editable.insert(Tix.END, 'Angola') + editable.insert(Tix.END, 'Bangladesh') + editable.insert(Tix.END, 'China') + editable.insert(Tix.END, 'Denmark') + editable.insert(Tix.END, 'Ecuador') + + history.insert(Tix.END, '/usr/bin/ksh') + history.insert(Tix.END, '/usr/local/lib/python') + history.insert(Tix.END, '/var/adm') + + static.pack(side=Tix.TOP, padx=5, pady=3) + editable.pack(side=Tix.TOP, padx=5, pady=3) + history.pack(side=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: + return states[0] + return states[i] + # why this procedure works as opposed to the previous one beats me. + +def MkControl(w): + global demo_spintxt + + prefix = Tix.OptionName(w) + if not prefix: prefix = '' + w.option_add('*' + prefix + '*TixControl*label.width', 10) + w.option_add('*' + prefix + '*TixControl*label.anchor', Tix.E) + w.option_add('*' + prefix + '*TixControl*entry.width', 13) + + demo_spintxt = Tix.StringVar() + demo_spintxt.set(states[0]) + simple = Tix.Control(w, label='Numbers') + spintxt = Tix.Control(w, label='States', variable=demo_spintxt) + 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=Tix.TOP, padx=5, pady=3) + spintxt.pack(side=Tix.TOP, padx=5, pady=3) + +def MkSelect(w): + prefix = Tix.OptionName(w) + if not prefix: prefix = '' + w.option_add('*' + prefix + '*TixSelect*label.anchor', Tix.CENTER) + w.option_add('*' + prefix + '*TixSelect*orientation', Tix.VERTICAL) + w.option_add('*' + prefix + '*TixSelect*labelSide', Tix.TOP) + + sel1 = Tix.Select(w, label='Mere Mortals', allowzero=1, radio=1) + sel2 = Tix.Select(w, label='Geeks', allowzero=1, radio=0) + + 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=Tix.LEFT, padx=5, pady=3, fill=Tix.X) + sel2.pack(side=Tix.LEFT, padx=5, pady=3, fill=Tix.X) + +def MkOptMenu(w): + prefix = Tix.OptionName(w) + if not prefix: prefix = '' + w.option_add('*' + prefix + '*TixOptionMenu*label.anchor', Tix.E) + m = Tix.OptionMenu(w, label='File Format : ', options='menubutton.width 15') + 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=Tix.X, padx=5, pady=3) + +def MkFileEnt(w): + msg = Tix.Message(w, font='-*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*', + relief=Tix.FLAT, width=240, anchor=Tix.N, + text='Press the "open file" icon button and a TixFileSelectDialog will popup.') + ent = Tix.FileEntry(w, label='Select a file : ') + msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3) + ent.pack(side=Tix.TOP, fill=Tix.X, padx=3, pady=3) + +def MkFileBox(w): + msg = Tix.Message(w, font='-*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*', + relief=Tix.FLAT, width=240, anchor=Tix.N, + text='The TixFileSelectBox 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 = Tix.FileSelectBox(w) + msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3) + box.pack(side=Tix.TOP, fill=Tix.X, padx=3, pady=3) + +def MkToolBar(w): + global demo + + prefix = Tix.OptionName(w) + if not prefix: prefix = '' + w.option_add('*' + prefix + '*TixSelect*frame.borderWidth', 1) + msg = Tix.Message(w, font='-*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*', + relief=Tix.FLAT, width=240, anchor=Tix.N, + text='The Select widget is also good for arranging buttons in a tool bar.') + bar = Tix.Frame(w, bd=2, relief=Tix.RAISED) + font = Tix.Select(w, allowzero=1, radio=0, label='') + para = Tix.Select(w, allowzero=0, radio=1, label='') + + 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=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3) + bar.pack(side=Tix.TOP, fill=Tix.X, padx=3, pady=3) + font.pack({'in':bar}, side=Tix.LEFT, padx=3, pady=3) + para.pack({'in':bar}, side=Tix.LEFT, padx=3, pady=3) + +def MkTitle(w): + prefix = Tix.OptionName(w) + if not prefix: prefix = '' + w.option_add('*' + prefix + '*TixSelect*frame.borderWidth', 1) + msg = Tix.Message(w, font='-*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*', + relief=Tix.FLAT, width=240, anchor=Tix.N, + text='There are many types of "chooser" widgets that allow the user to input different types of information') + msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3) + +def MkScroll(nb, name): + w = nb.page(name) + prefix = Tix.OptionName(w) + if not prefix: + prefix = '' + w.option_add('*' + prefix + '*TixLabelFrame*label.padX', 4) + + sls = Tix.LabelFrame(w, label='tixScrolledListBox') + swn = Tix.LabelFrame(w, label='tixScrolledWindow') + stx = Tix.LabelFrame(w, label='tixScrolledText') + + 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): + top = Tix.Frame(w, width=300, height=330) + bot = Tix.Frame(w) + msg = Tix.Message(top, font='-*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*', + relief=Tix.FLAT, width=200, anchor=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 = Tix.ScrolledListBox(top, scrollbar='auto') + list.place(x=50, y=150, width=120, height=80) + list.listbox.insert(Tix.END, 'Alabama') + list.listbox.insert(Tix.END, 'California') + list.listbox.insert(Tix.END, 'Montana') + list.listbox.insert(Tix.END, 'New Jersey') + list.listbox.insert(Tix.END, 'New York') + list.listbox.insert(Tix.END, 'Pennsylvania') + list.listbox.insert(Tix.END, 'Washington') + + rh = Tix.ResizeHandle(top, bg='black', + relief=Tix.RAISED, + handlesize=8, gridded=1, minwidth=50, minheight=30) + btn = Tix.Button(bot, text='Reset', command=lambda w=rh, x=list: SList_reset(w,x)) + top.propagate(0) + msg.pack(fill=Tix.X) + btn.pack(anchor=Tix.CENTER) + top.pack(expand=1, fill=Tix.BOTH) + bot.pack(fill=Tix.BOTH) + list.bind('', 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): + global demo + + top = Tix.Frame(w, width=330, height=330) + bot = Tix.Frame(w) + msg = Tix.Message(top, font='-*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*', + relief=Tix.FLAT, width=200, anchor=Tix.N, + text='The TixScrolledWindow widget allows you to scroll any kind of Tk widget. It is more versatile than a scrolled canvas widget.') + win = Tix.ScrolledWindow(top, scrollbar='auto') + image = Tix.Image('photo', file=demo.dir + "/bitmaps/tix.gif") + lbl = Tix.Label(win.window, image=image) + lbl.pack(expand=1, fill=Tix.BOTH) + + win.place(x=30, y=150, width=190, height=120) + + rh = Tix.ResizeHandle(top, bg='black', + relief=Tix.RAISED, + handlesize=8, gridded=1, minwidth=50, minheight=30) + btn = Tix.Button(bot, text='Reset', command=lambda w=rh, x=win: SWindow_reset(w,x)) + top.propagate(0) + msg.pack(fill=Tix.X) + btn.pack(anchor=Tix.CENTER) + top.pack(expand=1, fill=Tix.BOTH) + bot.pack(fill=Tix.BOTH) + win.bind('', 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): + top = Tix.Frame(w, width=330, height=330) + bot = Tix.Frame(w) + msg = Tix.Message(top, font='-*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*', + relief=Tix.FLAT, width=200, anchor=Tix.N, + text='The TixScrolledWindow widget allows you to scroll any kind of Tk widget. It is more versatile than a scrolled canvas widget.') + + win = Tix.ScrolledText(top, scrollbar='auto') +# win.text['wrap'] = 'none' + win.text.insert(Tix.END, 'This is a text widget embedded in a scrolled window. Although the original Tix demo does not have any text here, I decided to put in some so that you can see the effect of scrollbars etc.') + win.place(x=30, y=150, width=190, height=100) + + rh = Tix.ResizeHandle(top, bg='black', + relief=Tix.RAISED, + handlesize=8, gridded=1, minwidth=50, minheight=30) + btn = Tix.Button(bot, text='Reset', command=lambda w=rh, x=win: SText_reset(w,x)) + top.propagate(0) + msg.pack(fill=Tix.X) + btn.pack(anchor=Tix.CENTER) + top.pack(expand=1, fill=Tix.BOTH) + bot.pack(fill=Tix.BOTH) + win.bind('', 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) + prefix = Tix.OptionName(w) + if not prefix: + prefix = '' + w.option_add('*' + prefix + '*TixLabelFrame*label.padX', 4) + + pane = Tix.LabelFrame(w, label='tixPanedWindow') + note = Tix.LabelFrame(w, label='tixNoteBook') + + 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): + msg = Tix.Message(w, font='-*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*', + relief=Tix.FLAT, width=240, anchor=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 = Tix.Label(w, text='Newsgroup: comp.lang.python') + pane = Tix.PanedWindow(w, orientation='vertical') + + p1 = pane.add('list', min=70, size=100) + p2 = pane.add('text', min=70) + list = Tix.ScrolledListBox(p1) + text = Tix.ScrolledText(p2) + + list.listbox.insert(Tix.END, " 12324 Re: TK is good for your health") + list.listbox.insert(Tix.END, "+ 12325 Re: TK is good for your health") + list.listbox.insert(Tix.END, "+ 12326 Re: Tix is even better for your health (Was: TK is good...)") + list.listbox.insert(Tix.END, " 12327 Re: Tix is even better for your health (Was: TK is good...)") + list.listbox.insert(Tix.END, "+ 12328 Re: Tix is even better for your health (Was: TK is good...)") + list.listbox.insert(Tix.END, " 12329 Re: Tix is even better for your health (Was: TK is good...)") + list.listbox.insert(Tix.END, "+ 12330 Re: Tix is even better for your health (Was: TK is good...)") + + text.text['bg'] = list.listbox['bg'] + text.text['wrap'] = 'none' + text.text.insert(Tix.END, """ +Mon, 19 Jun 1995 11:39:52 comp.lang.tcl 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=Tix.BOTH, padx=4, pady=6) + text.pack(expand=1, fill=Tix.BOTH, padx=4, pady=6) + + msg.pack(side=Tix.TOP, padx=3, pady=3, fill=Tix.BOTH) + group.pack(side=Tix.TOP, padx=3, pady=3, fill=Tix.BOTH) + pane.pack(side=Tix.TOP, padx=3, pady=3, fill=Tix.BOTH, expand=1) + +def MkNoteBook(w): + msg = Tix.Message(w, font='-*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*', + relief=Tix.FLAT, width=240, anchor=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 + '*TixControl*entry.width', 10) + w.option_add('*' + prefix + '*TixControl*label.width', 18) + w.option_add('*' + prefix + '*TixControl*label.anchor', Tix.E) + w.option_add('*' + prefix + '*TixNoteBook*tagPadX', 8) + + nb = Tix.NoteBook(w, ipadx=6, ipady=6) + 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 = Tix.Frame(nb.hard_disk) + common.pack(side=Tix.RIGHT, padx=2, pady=2, fill=Tix.Y) + CreateCommonButtons(common) + + # Widgets belonging only to this page + a = Tix.Control(nb.hard_disk, value=12, label='Access Time: ') + w = Tix.Control(nb.hard_disk, value=400, label='Write Throughput: ') + r = Tix.Control(nb.hard_disk, value=400, label='Read Throughput: ') + c = Tix.Control(nb.hard_disk, value=1021, label='Capacity: ') + a.pack(side=Tix.TOP, padx=20, pady=2) + w.pack(side=Tix.TOP, padx=20, pady=2) + r.pack(side=Tix.TOP, padx=20, pady=2) + c.pack(side=Tix.TOP, padx=20, pady=2) + + common = Tix.Frame(nb.network) + common.pack(side=Tix.RIGHT, padx=2, pady=2, fill=Tix.Y) + CreateCommonButtons(common) + + a = Tix.Control(nb.network, value=12, label='Access Time: ') + w = Tix.Control(nb.network, value=400, label='Write Throughput: ') + r = Tix.Control(nb.network, value=400, label='Read Throughput: ') + c = Tix.Control(nb.network, value=1021, label='Capacity: ') + u = Tix.Control(nb.network, value=10, label='Users: ') + a.pack(side=Tix.TOP, padx=20, pady=2) + w.pack(side=Tix.TOP, padx=20, pady=2) + r.pack(side=Tix.TOP, padx=20, pady=2) + c.pack(side=Tix.TOP, padx=20, pady=2) + u.pack(side=Tix.TOP, padx=20, pady=2) + + msg.pack(side=Tix.TOP, padx=3, pady=3, fill=Tix.BOTH) + nb.pack(side=Tix.TOP, padx=5, pady=5, fill=Tix.BOTH, expand=1) + +def CreateCommonButtons(f): + ok = Tix.Button(f, text='OK', width = 6) + cancel = Tix.Button(f, text='Cancel', width = 6) + ok.pack(side=Tix.TOP, padx=2, pady=2) + cancel.pack(side=Tix.TOP, padx=2, pady=2) + +def MkDirList(nb, name): + w = nb.page(name) + prefix = Tix.OptionName(w) + if not prefix: + prefix = '' + w.option_add('*' + prefix + '*TixLabelFrame*label.padX', 4) + + dir = Tix.LabelFrame(w, label='tixDirList') + fsbox = Tix.LabelFrame(w, label='tixExFileSelectBox') + 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): + msg = Tix.Message(w, font='-*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*', + relief=Tix.FLAT, width=240, anchor=Tix.N, + text='The TixDirList widget gives a graphical representation of the file system directory and makes it easy for the user to choose and access directories.') + dirlist = Tix.DirList(w, options='hlist.padY 1 hlist.width 25 hlist.height 16') + msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3) + dirlist.pack(side=Tix.TOP, padx=3, pady=3) + +def MkExFileWidget(w): + msg = Tix.Message(w, font='-*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*', + relief=Tix.FLAT, width=240, anchor=Tix.N, + text='The TixExFileSelectBox widget is more user friendly than the Motif style FileSelectBox.') + # There's a bug in the ComboBoxes - the scrolledlistbox is destroyed + box = Tix.ExFileSelectBox(w, bd=2, relief=Tix.RAISED) + msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3) + box.pack(side=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', + 'Control' : 'Control', + 'Notebook' : 'NoteBook', + 'Option Menu' : 'OptMenu', + 'Popup Menu' : 'PopMenu', + 'ScrolledHList (1)' : 'SHList1', + 'ScrolledHList (2)' : 'SHList2', + 'Tree (dynamic)' : 'Tree' +} + +stypes = {} +stypes['widget'] = ['Balloon', 'Button Box', 'Combo Box', 'Control', + 'Notebook', 'Option Menu', 'Popup Menu', + 'ScrolledHList (1)', 'ScrolledHList (2)', 'Tree (dynamic)'] +stypes['image'] = ['Compound Image'] + +def MkSample(nb, name): + w = nb.page(name) + prefix = Tix.OptionName(w) + if not prefix: + prefix = '' + w.option_add('*' + prefix + '*TixLabelFrame*label.padX', 4) + + lab = Tix.Label(w, text='Select a sample program:', anchor=Tix.W) + lab1 = Tix.Label(w, text='Source:', anchor=Tix.W) + + slb = Tix.ScrolledHList(w, options='listbox.exportSelection 0') + slb.hlist['command'] = lambda args=0, w=w,slb=slb: Sample_Action(w, slb, 'run') + slb.hlist['browsecmd'] = lambda args=0, w=w,slb=slb: Sample_Action(w, slb, 'browse') + + stext = Tix.ScrolledText(w, name='stext') + stext.text.bind('<1>', stext.text.focus()) + stext.text.bind('', lambda w=stext.text: w.yview(scroll='-1 unit')) + stext.text.bind('', lambda w=stext.text: w.yview(scroll='1 unit')) + stext.text.bind('', lambda w=stext.text: w.xview(scroll='-1 unit')) + stext.text.bind('', lambda w=stext.text: w.xview(scroll='1 unit')) + + run = Tix.Button(w, text='Run ...', name='run', command=lambda args=0, w=w,slb=slb: Sample_Action(w, slb, 'run')) + view = Tix.Button(w, text='View Source ...', name='view', command=lambda args=0,w=w,slb=slb: Sample_Action(w, slb, 'view')) + + lab.form(top=0, left=0, right='&'+str(slb)) + slb.form(left=0, top=lab, bottom=-4) + lab1.form(left='&'+str(stext), top=0, right='&'+str(stext), bottom=stext) + run.form(left=str(slb)+' 30', bottom=-4) + view.form(left=run, bottom=-4) + stext.form(bottom=str(run)+' -5', left='&'+str(run), right='-0', top='&'+str(slb)) + + stext.text['bg'] = slb.hlist['bg'] + stext.text['state'] = 'disabled' + stext.text['wrap'] = 'none' + #XXX stext.text['font'] = fixed_font + + slb.hlist['separator'] = '.' + slb.hlist['width'] = 25 + slb.hlist['drawbranch'] = 0 + slb.hlist['indent'] = 10 + slb.hlist['wideselect'] = 1 + + for type in ['widget', 'image']: + if type != 'widget': + x = Tix.Frame(slb.hlist, bd=2, height=2, width=150, + relief=Tix.SUNKEN, bg=slb.hlist['bg']) + slb.hlist.add_child(itemtype=Tix.WINDOW, window=x, state='disabled') + x = slb.hlist.add_child(itemtype=Tix.TEXT, state='disabled', + text=comments[type]) + for key in stypes[type]: + slb.hlist.add_child(x, itemtype=Tix.TEXT, data=key, + text=key) + slb.hlist.selection_clear() + + run['state'] = 'disabled' + view['state'] = 'disabled' + +def Sample_Action(w, slb, action): + global demo + + run = w._nametowidget(str(w) + '.run') + view = w._nametowidget(str(w) + '.view') + stext = w._nametowidget(str(w) + '.stext') + + 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 = Tix.Toplevel() + w.title(title) + rtn = eval(prog + '.RunSample') + rtn(w) + elif action == 'view': + w = 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): + b = Tix.Button(w, text='Close', command=w.destroy) + t = 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() + + t.text['highlightcolor'] = t['bg'] + t.text['bd'] = 2 + t.text['bg'] = t['bg'] + t.text['wrap'] = 'none' + + ReadFile(t.text, fname) + +def ReadFile(w, fname): + old_state = w['state'] + w['state'] = 'normal' + w.delete('0.0', Tix.END) + + try: + f = open(fname) + lines = f.readlines() + for s in lines: + w.insert(Tix.END, s) + f.close() + finally: +# w.see('1.0') + w['state'] = old_state + +if __name__ == '__main__': + main() + diff --git a/Lib/lib-tk/Tix.py b/Lib/lib-tk/Tix.py new file mode 100755 index 0000000000..a8c2ea5cca --- /dev/null +++ b/Lib/lib-tk/Tix.py @@ -0,0 +1,1266 @@ +# +# $Id$ +# +# Tix.py -- Tix widget wrappers, part of PyTix. +# +# - Sudhir Shenoy (sshenoy@gol.com), Dec. 1995. +# based on an idea (and a little code !!) of Jean-Marc Lugrin +# (lugrin@ms.com) +# +# NOTE: In order to minimize changes to Tkinter.py, some of the code here +# (TixWidget.__init__) has been taken from Tkinter (Widget.__init__) +# and will break if there are major changes in Tkinter. +# +# The Tix widgets are represented by a class hierarchy in python with proper +# inheritance of base classes. +# +# As a result after creating a 'w = StdButtonBox', I can write +# w.ok['text'] = 'Who Cares' +# or w.ok['bg'] = w['bg'] +# or even w.ok.invoke() +# etc. +# +# Compare the demo tixwidgets.py to the original Tcl program and you will +# appreciate the advantages. +# + +import string +from Tkinter import * +from Tkinter import _flatten, _cnfmerge, _default_root + +# WARNING - TkVersion is a limited precision floating point number +if TkVersion < 3.999: + raise ImportError, "This version of Tix.py requires Tk 4.0 or higher" + +import _tkinter # If this fails your Python may not be configured for Tk +# TixVersion = string.atof(tkinter.TIX_VERSION) # If this fails your Python may not be configured for Tix +# WARNING - TixVersion is a limited precision floating point number + +# Some more constants (for consistency with Tkinter) +WINDOW = 'window' +TEXT = 'text' +STATUS = 'status' +IMMEDIATE = 'immediate' +IMAGE = 'image' +IMAGETEXT = 'imagetext' +BALLOON = 'balloon' +AUTO = 'auto' +ACROSSTOP = 'acrosstop' + +# BEWARE - this is implemented by copying some code from the Widget class +# in Tkinter (to override Widget initialization) and is therefore +# liable to break. +import Tkinter, os +class Tk(Tkinter.Tk): + """Toplevel widget of Tix which represents mostly the main window + of an application. It has an associated Tcl interpreter.""" + def __init__(self, screenName=None, baseName=None, className='Tk'): + Tkinter.Tk.__init__(self, screenName, baseName, className) + tixlib = os.environ.get('TIX_LIBRARY') + if tixlib is not None: + self.tk.eval('global auto_path; lappend auto_path {%s}' % tixlib) + self.tk.eval('global tcl_pkgPath; lappend tcl_pkgPath {%s}' % tixlib) + # Load Tix - this should work dynamically or statically + # If it's static, lib/tix8.1/pkgIndex.tcl should have 'load {} Tix' + # If it's dynamic, it should have 'load libtix8.1.8.2.so Tix' + self.tk.eval('package require Tix') + +# The Tix 'tixForm' geometry manager +class Form: + """The Tix Form geometry manager + + Widgets can be arranged by specifying attachments to other widgets. + See Tix documentation for complete details""" + + def config(self, cnf={}, **kw): + apply(self.tk.call, ('tixForm', self._w) + self._options(cnf, kw)) + + form = config + + def __setitem__(self, key, value): + Form.form({key: value}) + + def check(self): + return self.tk.call('tixForm', 'check', self._w) + + def forget(self): + self.tk.call('tixForm', 'forget', self._w) + + def grid(self, xsize=0, ysize=0): + if (not xsize) and (not ysize): + x = self.tk.call('tixForm', 'grid', self._w) + y = self.tk.splitlist(x) + z = () + for x in y: + z = z + (self.tk.getint(x),) + return z + self.tk.call('tixForm', 'grid', self._w, xsize, ysize) + + def info(self, option=None): + if not option: + return self.tk.call('tixForm', 'info', self._w) + if option[0] != '-': + option = '-' + option + return self.tk.call('tixForm', 'info', self._w, option) + + def slaves(self): + return map(self._nametowidget, + self.tk.splitlist( + self.tk.call( + 'tixForm', 'slaves', self._w))) + + +Tkinter.Widget.__bases__ = Tkinter.Widget.__bases__ + (Form,) + +class TixWidget(Widget): + """A TixWidget class is used to package all (or most) Tix widgets. + + Widget initialization is extended in two ways: + 1) It is possible to give a list of options which must be part of + the creation command (so called Tix 'static' options). These cannot be + given as a 'config' command later. + 2) It is possible to give the name of an existing TK widget. These are + child widgets created automatically by a Tix mega-widget. The Tk call + to create these widgets is therefore bypassed in TixWidget.__init__ + + Both options are for use by subclasses only. + """ + def __init__ (self, master=None, widgetName=None, + static_options=None, cnf={}, kw={}): + # Merge keywords and dictionary arguments + if kw: + cnf = _cnfmerge((cnf, kw)) + else: + cnf = _cnfmerge(cnf) + + # Move static options into extra. static_options must be + # a list of keywords (or None). + extra=() + if static_options: + for k,v in cnf.items()[:]: + if k in static_options: + extra = extra + ('-' + k, v) + del cnf[k] + + self.widgetName = widgetName + Widget._setup(self, master, cnf) + + # If widgetName is None, this is a dummy creation call where the + # corresponding Tk widget has already been created by Tix + if widgetName: + apply(self.tk.call, (widgetName, self._w) + extra) + + # Non-static options - to be done via a 'config' command + if cnf: + Widget.config(self, cnf) + + # Dictionary to hold subwidget names for easier access. We can't + # use the children list because the public Tix names may not be the + # same as the pathname component + self.subwidget_list = {} + + # We set up an attribute access function so that it is possible to + # do w.ok['text'] = 'Hello' rather than w.subwidget('ok')['text'] = 'Hello' + # when w is a StdButtonBox. + # We can even do w.ok.invoke() because w.ok is subclassed from the + # Button class if you go through the proper constructors + def __getattr__(self, name): + if self.subwidget_list.has_key(name): + return self.subwidget_list[name] + raise AttributeError, name + + # Set a variable without calling its action routine + def set_silent(self, value): + self.tk.call('tixSetSilent', self._w, value) + + # Return the named subwidget (which must have been created by + # the sub-class). + def subwidget(self, name): + n = self._subwidget_name(name) + if not n: + raise TclError, "Subwidget " + name + " not child of " + self._name + # Remove header of name and leading dot + n = n[len(self._w)+1:] + return self._nametowidget(n) + + # Return all subwidgets + def subwidgets_all(self): + names = self._subwidget_names() + if not names: + return [] + retlist = [] + for name in names: + name = name[len(self._w)+1:] + try: + retlist.append(self._nametowidget(name)) + except: + # some of the widgets are unknown e.g. border in LabelFrame + pass + return retlist + + # Get a subwidget name (returns a String, not a Widget !) + def _subwidget_name(self,name): + try: + return self.tk.call(self._w, 'subwidget', name) + except TclError: + return None + + # Return the name of all subwidgets + def _subwidget_names(self): + try: + x = self.tk.call(self._w, 'subwidgets', '-all') + return self.tk.split(x) + except TclError: + return None + + # Set configuration options for all subwidgets (and self) + def config_all(self, option, value): + if option == '': + return + elif type(option) != type(''): + option = `option` + if type(value) != type(''): + value = `value` + names = self._subwidget_names() + for name in names: + self.tk.call(name, 'configure', '-' + option, value) + +# Subwidgets are child widgets created automatically by mega-widgets. +# In python, we have to create these subwidgets manually to mirror their +# existence in Tk/Tix. +class TixSubWidget(TixWidget): + """Subwidget class. + + This is used to mirror child widgets automatically created + by Tix/Tk as part of a mega-widget in Python (which is not informed + of this)""" + + def __init__(self, master, name, + destroy_physically=1, check_intermediate=1): + if check_intermediate: + path = master._subwidget_name(name) + try: + path = path[len(master._w)+1:] + plist = string.splitfields(path, '.') + except: + plist = [] + + if (not check_intermediate) or len(plist) < 2: + # immediate descendant + TixWidget.__init__(self, master, None, None, {'name' : name}) + else: + # Ensure that the intermediate widgets exist + parent = master + for i in range(len(plist) - 1): + n = string.joinfields(plist[:i+1], '.') + try: + w = master._nametowidget(n) + parent = w + except KeyError: + # Create the intermediate widget + parent = TixSubWidget(parent, plist[i], + destroy_physically=0, + check_intermediate=0) + TixWidget.__init__(self, parent, None, None, {'name' : name}) + self.destroy_physically = destroy_physically + + def destroy(self): + # For some widgets e.g., a NoteBook, when we call destructors, + # we must be careful not to destroy the frame widget since this + # also destroys the parent NoteBook thus leading to an exception + # in Tkinter when it finally calls Tcl to destroy the NoteBook + for c in self.children.values(): c.destroy() + if self.master.children.has_key(self._name): + del self.master.children[self._name] + if self.master.subwidget_list.has_key(self._name): + del self.master.subwidget_list[self._name] + if self.destroy_physically: + # This is bypassed only for a few widgets + self.tk.call('destroy', self._w) + + +# Useful func. to split Tcl lists and return as a dict. From Tkinter.py +def _lst2dict(lst): + dict = {} + for x in lst: + dict[x[0][1:]] = (x[0][1:],) + x[1:] + return dict + +# Useful class to create a display style - later shared by many items. +# Contributed by Steffen Kremser +class DisplayStyle: + """DisplayStyle - handle configuration options shared by + (multiple) Display Items""" + + def __init__(self, itemtype, cnf={}, **kw ): + master = _default_root # global from Tkinter + if not master and cnf.has_key('refwindow'): master=cnf['refwindow'] + elif not master and kw.has_key('refwindow'): master= kw['refwindow'] + elif not master: raise RuntimeError, "Too early to create display style: no root window" + self.tk = master.tk + self.stylename = apply(self.tk.call, ('tixDisplayStyle', itemtype) + + self._options(cnf,kw) ) + + def __str__(self): + return self.stylename + + def _options(self, cnf, kw ): + if kw and cnf: + cnf = _cnfmerge((cnf, kw)) + elif kw: + cnf = kw + opts = () + for k, v in cnf.items(): + opts = opts + ('-'+k, v) + return opts + + def delete(self): + self.tk.call(self.stylename, 'delete') + del(self) + + def __setitem__(self,key,value): + self.tk.call(self.stylename, 'configure', '-%s'%key, value) + + def config(self, cnf={}, **kw): + return _lst2dict( + self.tk.split( + apply(self.tk.call, + (self.stylename, 'configure') + self._options(cnf,kw)))) + + def __getitem__(self,key): + return self.tk.call(self.stylename, 'cget', '-%s'%key, value) + + +###################################################### +### The Tix Widget classes - in alphabetical order ### +###################################################### + +class Balloon(TixWidget): + """Balloon help widget. + + Subwidget Class + --------- ----- + label Label + message Message""" + + def __init__(self, master=None, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixBalloon', ['options'], cnf, kw) + self.subwidget_list['label'] = _dummyLabel(self, 'label', + destroy_physically=0) + self.subwidget_list['message'] = _dummyLabel(self, 'message', + destroy_physically=0) + + def bind_widget(self, widget, cnf={}, **kw): + """Bind balloon widget to another. + One balloon widget may be bound to several widgets at the same time""" + apply(self.tk.call, + (self._w, 'bind', widget._w) + self._options(cnf, kw)) + + def unbind_widget(self, widget): + self.tk.call(self._w, 'unbind', widget._w) + +class ButtonBox(TixWidget): + """ButtonBox - A container for pushbuttons""" + def __init__(self, master=None, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixButtonBox', + ['orientation', 'options'], cnf, kw) + + def add(self, name, cnf={}, **kw): + """Add a button with given name to box.""" + + btn = apply(self.tk.call, + (self._w, 'add', name) + self._options(cnf, kw)) + self.subwidget_list[name] = _dummyButton(self, name) + return btn + + def invoke(self, name): + if self.subwidget_list.has_key(name): + self.tk.call(self._w, 'invoke', name) + +class ComboBox(TixWidget): + """ComboBox - an Entry field with a dropdown menu + + Subwidget Class + --------- ----- + entry Entry + arrow Button + slistbox ScrolledListBox + tick Button } + cross Button } present if created with the fancy option""" + + def __init__ (self, master=None, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixComboBox', + ['editable', 'dropdown', 'fancy', 'options'], + cnf, kw) + self.subwidget_list['label'] = _dummyLabel(self, 'label') + self.subwidget_list['entry'] = _dummyEntry(self, 'entry') + self.subwidget_list['arrow'] = _dummyButton(self, 'arrow') + self.subwidget_list['slistbox'] = _dummyScrolledListBox(self, + 'slistbox') + try: + self.subwidget_list['tick'] = _dummyButton(self, 'tick') + self.subwidget_list['cross'] = _dummyButton(self, 'cross') + except TypeError: + # unavailable when -fancy not specified + pass + + def add_history(self, str): + self.tk.call(self._w, 'addhistory', str) + + def append_history(self, str): + self.tk.call(self._w, 'appendhistory', str) + + def insert(self, index, str): + self.tk.call(self._w, 'insert', index, str) + + def pick(self, index): + self.tk.call(self._w, 'pick', index) + +class Control(TixWidget): + """Control - An entry field with value change arrows. + + Subwidget Class + --------- ----- + incr Button + decr Button + entry Entry + label Label""" + + def __init__ (self, master=None, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixControl', ['options'], cnf, kw) + self.subwidget_list['incr'] = _dummyButton(self, 'incr') + self.subwidget_list['decr'] = _dummyButton(self, 'decr') + self.subwidget_list['label'] = _dummyLabel(self, 'label') + self.subwidget_list['entry'] = _dummyEntry(self, 'entry') + + def decrement(self): + self.tk.call(self._w, 'decr') + + def increment(self): + self.tk.call(self._w, 'incr') + + def invoke(self): + self.tk.call(self._w, 'invoke') + + def update(self): + self.tk.call(self._w, 'update') + +class DirList(TixWidget): + """DirList - Directory Listing. + + Subwidget Class + --------- ----- + hlist HList + hsb Scrollbar + vsb Scrollbar""" + + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixDirList', ['options'], cnf, kw) + self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') + self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') + self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') + + def chdir(self, dir): + self.tk.call(self._w, 'chdir', dir) + +class DirTree(TixWidget): + """DirList - Directory Listing in a hierarchical view. + + Subwidget Class + --------- ----- + hlist HList + hsb Scrollbar + vsb Scrollbar""" + + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixDirTree', ['options'], cnf, kw) + self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') + self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') + self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') + + def chdir(self, dir): + self.tk.call(self._w, 'chdir', dir) + +class ExFileSelectBox(TixWidget): + """ExFileSelectBox - MS Windows style file select box. + + Subwidget Class + --------- ----- + cancel Button + ok Button + hidden Checkbutton + types ComboBox + dir ComboBox + file ComboBox + dirlist ScrolledListBox + filelist ScrolledListBox""" + + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixExFileSelectBox', ['options'], cnf, kw) + self.subwidget_list['cancel'] = _dummyButton(self, 'cancel') + self.subwidget_list['ok'] = _dummyButton(self, 'ok') + self.subwidget_list['hidden'] = _dummyCheckbutton(self, 'hidden') + self.subwidget_list['types'] = _dummyComboBox(self, 'types') + self.subwidget_list['dir'] = _dummyComboBox(self, 'dir') + self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist') + self.subwidget_list['file'] = _dummyComboBox(self, 'file') + self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist') + + def filter(self): + self.tk.call(self._w, 'filter') + + def invoke(self): + self.tk.call(self._w, 'invoke') + +class ExFileSelectDialog(TixWidget): + """ExFileSelectDialog - MS Windows style file select dialog. + + Subwidgets Class + ---------- ----- + fsbox ExFileSelectBox""" + + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixExFileSelectDialog', + ['options'], cnf, kw) + self.subwidget_list['fsbox'] = _dummyExFileSelectBox(self, 'fsbox') + + def popup(self): + self.tk.call(self._w, 'popup') + + def popdown(self): + self.tk.call(self._w, 'popdown') + +class FileSelectBox(TixWidget): + """ExFileSelectBox - Motif style file select box. + + Subwidget Class + --------- ----- + selection ComboBox + filter ComboBox + dirlist ScrolledListBox + filelist ScrolledListBox""" + + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixFileSelectBox', ['options'], cnf, kw) + self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist') + self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist') + self.subwidget_list['filter'] = _dummyComboBox(self, 'filter') + self.subwidget_list['selection'] = _dummyComboBox(self, 'selection') + + def apply_filter(self): # name of subwidget is same as command + self.tk.call(self._w, 'filter') + + def invoke(self): + self.tk.call(self._w, 'invoke') + +class FileSelectDialog(TixWidget): + """FileSelectDialog - Motif style file select dialog. + + Subwidgets Class + ---------- ----- + btns StdButtonBox + fsbox FileSelectBox""" + + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixFileSelectDialog', + ['options'], cnf, kw) + self.subwidget_list['btns'] = _dummyStdButtonBox(self, 'btns') + self.subwidget_list['fsbox'] = _dummyFileSelectBox(self, 'fsbox') + + def popup(self): + self.tk.call(self._w, 'popup') + + def popdown(self): + self.tk.call(self._w, 'popdown') + +class FileEntry(TixWidget): + """FileEntry - Entry field with button that invokes a FileSelectDialog + + Subwidgets Class + ---------- ----- + button Button + entry Entry""" + + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixFileEntry', + ['dialogtype', 'options'], cnf, kw) + self.subwidget_list['button'] = _dummyButton(self, 'button') + self.subwidget_list['entry'] = _dummyEntry(self, 'entry') + + def invoke(self): + self.tk.call(self._w, 'invoke') + + def file_dialog(self): + # XXX return python object + pass + +class HList(TixWidget): + """HList - Hierarchy display. + + Subwidgets - None""" + + def __init__ (self,master=None,cnf={}, **kw): + TixWidget.__init__(self, master, 'tixHList', + ['columns', 'options'], cnf, kw) + + def add(self, entry, cnf={}, **kw): + return apply(self.tk.call, + (self._w, 'add', entry) + self._options(cnf, kw)) + + def add_child(self, parent=None, cnf={}, **kw): + if not parent: + parent = '' + return apply(self.tk.call, + (self._w, 'addchild', parent) + self._options(cnf, kw)) + + def anchor_set(self, entry): + self.tk.call(self._w, 'anchor', 'set', entry) + + def anchor_clear(self): + self.tk.call(self._w, 'anchor', 'clear') + + def column_width(self, col=0, width=None, chars=None): + if not chars: + return self.tk.call(self._w, 'column', 'width', col, width) + else: + return self.tk.call(self._w, 'column', 'width', col, + '-char', chars) + + def delete_all(self): + self.tk.call(self._w, 'delete', 'all') + + def delete_entry(self, entry): + self.tk.call(self._w, 'delete', 'entry', entry) + + def delete_offsprings(self, entry): + self.tk.call(self._w, 'delete', 'offsprings', entry) + + def delete_siblings(self, entry): + self.tk.call(self._w, 'delete', 'siblings', entry) + + def dragsite_set(self, index): + self.tk.call(self._w, 'dragsite', 'set', index) + + def dragsite_clear(self): + self.tk.call(self._w, 'dragsite', 'clear') + + def dropsite_set(self, index): + self.tk.call(self._w, 'dropsite', 'set', index) + + def dropsite_clear(self): + self.tk.call(self._w, 'dropsite', 'clear') + + def header_create(self, col, cnf={}, **kw): + apply(self.tk.call, + (self._w, 'header', 'create', col) + self._options(cnf, kw)) + + def header_configure(self, col, cnf={}, **kw): + if cnf is None: + return _lst2dict( + self.tk.split( + self.tk.call(self._w, 'header', 'configure', col))) + apply(self.tk.call, (self._w, 'header', 'configure', col) + + self._options(cnf, kw)) + + def header_cget(self, col, opt): + return self.tk.call(self._w, 'header', 'cget', col, opt) + + def header_exists(self, col): + return self.tk.call(self._w, 'header', 'exists', col) + + def header_delete(self, col): + self.tk.call(self._w, 'header', 'delete', col) + + def header_size(self, col): + return self.tk.call(self._w, 'header', 'size', col) + + def hide_entry(self, entry): + self.tk.call(self._w, 'hide', 'entry', entry) + + def indicator_create(self, entry, cnf={}, **kw): + apply(self.tk.call, + (self._w, 'indicator', 'create', entry) + self._options(cnf, kw)) + + def indicator_configure(self, entry, cnf={}, **kw): + if cnf is None: + return _lst2dict( + self.tk.split( + self.tk.call(self._w, 'indicator', 'configure', entry))) + apply(self.tk.call, + (self._w, 'indicator', 'configure', entry) + self._options(cnf, kw)) + + def indicator_cget(self, entry, opt): + return self.tk.call(self._w, 'indicator', 'cget', entry, opt) + + def indicator_exists(self, entry): + return self.tk.call (self._w, 'indicator', 'exists', entry) + + def indicator_delete(self, entry): + self.tk.call(self._w, 'indicator', 'delete', entry) + + def indicator_size(self, entry): + return self.tk.call(self._w, 'indicator', 'size', entry) + + def info_anchor(self): + return self.tk.call(self._w, 'info', 'anchor') + + def info_children(self, entry=None): + c = self.tk.call(self._w, 'info', 'children', entry) + return self.tk.splitlist(c) + + def info_data(self, entry): + return self.tk.call(self._w, 'info', 'data', entry) + + def info_exists(self, entry): + return self.tk.call(self._w, 'info', 'exists', entry) + + def info_hidden(self, entry): + return self.tk.call(self._w, 'info', 'hidden', entry) + + def info_next(self, entry): + return self.tk.call(self._w, 'info', 'next', entry) + + def info_parent(self, entry): + return self.tk.call(self._w, 'info', 'parent', entry) + + def info_prev(self, entry): + return self.tk.call(self._w, 'info', 'prev', entry) + + def info_selection(self): + c = self.tk.call(self._w, 'info', 'selection') + return self.tk.splitlist(c) + + def item_cget(self, col, opt): + return self.tk.call(self._w, 'item', 'cget', col, opt) + + def item_configure(self, entry, col, cnf={}, **kw): + if cnf is None: + return _lst2dict( + self.tk.split( + self.tk.call(self._w, 'item', 'configure', entry, col))) + apply(self.tk.call, (self._w, 'item', 'configure', entry, col) + + self._options(cnf, kw)) + + def item_create(self, entry, col, cnf={}, **kw): + apply(self.tk.call, + (self._w, 'item', 'create', entry, col) + self._options(cnf, kw)) + + def item_exists(self, entry, col): + return self.tk.call(self._w, 'item', 'exists', entry, col) + + def item_delete(self, entry, col): + self.tk.call(self._w, 'item', 'delete', entry, col) + + def nearest(self, y): + return self.tk.call(self._w, 'nearest', y) + + def see(self, entry): + self.tk.call(self._w, 'see', entry) + + def selection_clear(self, cnf={}, **kw): + apply(self.tk.call, + (self._w, 'selection', 'clear') + self._options(cnf, kw)) + + def selection_includes(self, entry): + return self.tk.call(self._w, 'selection', 'includes', entry) + + def selection_set(self, first, last=None): + self.tk.call(self._w, 'selection', 'set', first, last) + + def show_entry(self, entry): + return self.tk.call(self._w, 'show', 'entry', entry) + + def xview(self, *args): + apply(self.tk.call, (self._w, 'xview') + args) + + def yview(self, *args): + apply(self.tk.call, (self._w, 'yview') + args) + +class InputOnly(TixWidget): + """InputOnly - Invisible widget. + + Subwidgets - None""" + + def __init__ (self,master=None,cnf={}, **kw): + TixWidget.__init__(self, master, 'tixInputOnly', None, cnf, kw) + +class LabelEntry(TixWidget): + """LabelEntry - Entry field with label. + + Subwidgets Class + ---------- ----- + label Label + entry Entry""" + + def __init__ (self,master=None,cnf={}, **kw): + TixWidget.__init__(self, master, 'tixLabelEntry', + ['labelside','options'], cnf, kw) + self.subwidget_list['label'] = _dummyLabel(self, 'label') + self.subwidget_list['entry'] = _dummyEntry(self, 'entry') + +class LabelFrame(TixWidget): + """LabelFrame - Labelled Frame container. + + Subwidgets Class + ---------- ----- + label Label + frame Frame""" + + def __init__ (self,master=None,cnf={}, **kw): + TixWidget.__init__(self, master, 'tixLabelFrame', + ['labelside','options'], cnf, kw) + self.subwidget_list['label'] = _dummyLabel(self, 'label') + self.subwidget_list['frame'] = _dummyFrame(self, 'frame') + +class NoteBook(TixWidget): + """NoteBook - Multi-page container widget (tabbed notebook metaphor). + + Subwidgets Class + ---------- ----- + nbframe NoteBookFrame + g/p widgets added dynamically""" + + def __init__ (self,master=None,cnf={}, **kw): + TixWidget.__init__(self,master,'tixNoteBook', ['options'], cnf, kw) + self.subwidget_list['nbframe'] = TixSubWidget(self, 'nbframe', + destroy_physically=0) + + def add(self, name, cnf={}, **kw): + apply(self.tk.call, + (self._w, 'add', name) + self._options(cnf, kw)) + self.subwidget_list[name] = TixSubWidget(self, name) + return self.subwidget_list[name] + + def delete(self, name): + self.tk.call(self._w, 'delete', name) + + def page(self, name): + return self.subwidget(name) + + def pages(self): + # Can't call subwidgets_all directly because we don't want .nbframe + names = self.tk.split(self.tk.call(self._w, 'pages')) + ret = [] + for x in names: + ret.append(self.subwidget(x)) + return ret + + def raise_page(self, name): # raise is a python keyword + self.tk.call(self._w, 'raise', name) + + def raised(self): + return self.tk.call(self._w, 'raised') + +class NoteBookFrame(TixWidget): + """Will be added when Tix documentation is available !!!""" + pass + +class OptionMenu(TixWidget): + """OptionMenu - Option menu widget. + + Subwidget Class + --------- ----- + menubutton Menubutton + menu Menu""" + + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixOptionMenu', ['options'], cnf, kw) + self.subwidget_list['menubutton'] = _dummyMenubutton(self, 'menubutton') + self.subwidget_list['menu'] = _dummyMenu(self, 'menu') + + def add_command(self, name, cnf={}, **kw): + apply(self.tk.call, + (self._w, 'add', 'command', name) + self._options(cnf, kw)) + + def add_separator(self, name, cnf={}, **kw): + apply(self.tk.call, + (self._w, 'add', 'separator', name) + self._options(cnf, kw)) + + def delete(self, name): + self.tk.call(self._w, 'delete', name) + + def disable(self, name): + self.tk.call(self._w, 'disable', name) + + def enable(self, name): + self.tk.call(self._w, 'enable', name) + +class PanedWindow(TixWidget): + """PanedWindow - Multi-pane container widget. Panes are resizable. + + Subwidgets Class + ---------- ----- + g/p widgets added dynamically""" + + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixPanedWindow', ['orientation', 'options'], cnf, kw) + + def add(self, name, cnf={}, **kw): + apply(self.tk.call, + (self._w, 'add', name) + self._options(cnf, kw)) + self.subwidget_list[name] = TixSubWidget(self, name, + check_intermediate=0) + return self.subwidget_list[name] + + def panes(self): + names = self.tk.call(self._w, 'panes') + ret = [] + for x in names: + ret.append(self.subwidget(x)) + return ret + +class PopupMenu(TixWidget): + """PopupMenu widget. + + Subwidgets Class + ---------- ----- + menubutton Menubutton + menu Menu""" + + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixPopupMenu', ['options'], cnf, kw) + self.subwidget_list['menubutton'] = _dummyMenubutton(self, 'menubutton') + self.subwidget_list['menu'] = _dummyMenu(self, 'menu') + + def bind_widget(self, widget): + self.tk.call(self._w, 'bind', widget._w) + + def unbind_widget(self, widget): + self.tk.call(self._w, 'unbind', widget._w) + + def post_widget(self, widget, x, y): + self.tk.call(self._w, 'post', widget._w, x, y) + +class ResizeHandle(TixWidget): + """Incomplete - no documentation in Tix for this !!!""" + + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixResizeHandle', + ['options'], cnf, kw) + + def attach_widget(self, widget): + self.tk.call(self._w, 'attachwidget', widget._w) + +class ScrolledHList(TixWidget): + """ScrolledHList - HList with scrollbars.""" + + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixScrolledHList', ['options'], + cnf, kw) + self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') + self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') + self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') + +class ScrolledListBox(TixWidget): + """ScrolledListBox - Listbox with scrollbars.""" + + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixScrolledListBox', ['options'], cnf, kw) + self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox') + self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') + self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') + +class ScrolledText(TixWidget): + """ScrolledText - Text with scrollbars.""" + + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixScrolledText', ['options'], cnf, kw) + self.subwidget_list['text'] = _dummyText(self, 'text') + self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') + self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') + +class ScrolledTList(TixWidget): + """ScrolledTList - TList with scrollbars.""" + + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixScrolledTList', ['options'], + cnf, kw) + self.subwidget_list['tlist'] = _dummyTList(self, 'tlist') + self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') + self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') + +class ScrolledWindow(TixWidget): + """ScrolledWindow - Window with scrollbars.""" + + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixScrolledWindow', ['options'], cnf, kw) + self.subwidget_list['window'] = _dummyFrame(self, 'window') + self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') + self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') + +class Select(TixWidget): + """Select - Container for buttons. Can enforce radio buttons etc. + + Subwidgets are buttons added dynamically""" + + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixSelect', + ['allowzero', 'radio', 'orientation', 'labelside', + 'options'], + cnf, kw) + self.subwidget_list['label'] = _dummyLabel(self, 'label') + + def add(self, name, cnf={}, **kw): + apply(self.tk.call, + (self._w, 'add', name) + self._options(cnf, kw)) + self.subwidget_list[name] = _dummyButton(self, name) + return self.subwidget_list[name] + + def invoke(self, name): + self.tk.call(self._w, 'invoke', name) + +class StdButtonBox(TixWidget): + """StdButtonBox - Standard Button Box (OK, Apply, Cancel and Help) """ + + def __init__(self, master=None, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixStdButtonBox', + ['orientation', 'options'], cnf, kw) + self.subwidget_list['ok'] = _dummyButton(self, 'ok') + self.subwidget_list['apply'] = _dummyButton(self, 'apply') + self.subwidget_list['cancel'] = _dummyButton(self, 'cancel') + self.subwidget_list['help'] = _dummyButton(self, 'help') + + def invoke(self, name): + if self.subwidget_list.has_key(name): + self.tk.call(self._w, 'invoke', name) + +class TList(TixWidget): + """TList - Hierarchy display. + + Subwidgets - None""" + + def __init__ (self,master=None,cnf={}, **kw): + TixWidget.__init__(self, master, 'tixTList', ['options'], cnf, kw) + + def active_set(self, index): + self.tk.call(self._w, 'active', 'set', index) + + def active_clear(self): + self.tk.call(self._w, 'active', 'clear') + + def anchor_set(self, index): + self.tk.call(self._w, 'anchor', 'set', index) + + def anchor_clear(self): + self.tk.call(self._w, 'anchor', 'clear') + + def delete(self, from_, to=None): + self.tk.call(self._w, 'delete', from_, to) + + def dragsite_set(self, index): + self.tk.call(self._w, 'dragsite', 'set', index) + + def dragsite_clear(self): + self.tk.call(self._w, 'dragsite', 'clear') + + def dropsite_set(self, index): + self.tk.call(self._w, 'dropsite', 'set', index) + + def dropsite_clear(self): + self.tk.call(self._w, 'dropsite', 'clear') + + def insert(self, index, cnf={}, **kw): + apply(self.tk.call, + (self._w, 'insert', index) + self._options(cnf, kw)) + + def info_active(self): + return self.tk.call(self._w, 'info', 'active') + + def info_anchor(self): + return self.tk.call(self._w, 'info', 'anchor') + + def info_down(self, index): + return self.tk.call(self._w, 'info', 'down', index) + + def info_left(self, index): + return self.tk.call(self._w, 'info', 'left', index) + + def info_right(self, index): + return self.tk.call(self._w, 'info', 'right', index) + + def info_selection(self): + c = self.tk.call(self._w, 'info', 'selection') + return self.tk.splitlist(c) + + def info_size(self): + return self.tk.call(self._w, 'info', 'size') + + def info_up(self, index): + return self.tk.call(self._w, 'info', 'up', index) + + def nearest(self, x, y): + return self.tk.call(self._w, 'nearest', x, y) + + def see(self, index): + self.tk.call(self._w, 'see', index) + + def selection_clear(self, cnf={}, **kw): + apply(self.tk.call, + (self._w, 'selection', 'clear') + self._options(cnf, kw)) + + def selection_includes(self, index): + return self.tk.call(self._w, 'selection', 'includes', index) + + def selection_set(self, first, last=None): + self.tk.call(self._w, 'selection', 'set', first, last) + + def xview(self, *args): + apply(self.tk.call, (self._w, 'xview') + args) + + def yview(self, *args): + apply(self.tk.call, (self._w, 'yview') + args) + +class Tree(TixWidget): + """Tree - The tixTree widget (general purpose DirList like widget)""" + + def __init__(self, master=None, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixTree', + ['options'], cnf, kw) + self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') + self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') + self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') + + def autosetmode(self): + self.tk.call(self._w, 'autosetmode') + + def close(self, entrypath): + self.tk.call(self._w, 'close', entrypath) + + def getmode(self, entrypath): + return self.tk.call(self._w, 'getmode', entrypath) + + def open(self, entrypath): + self.tk.call(self._w, 'open', entrypath) + + def setmode(self, entrypath, mode='none'): + self.tk.call(self._w, 'setmode', entrypath, mode) + +########################################################################### +### The subclassing below is used to instantiate the subwidgets in each ### +### mega widget. This allows us to access their methods directly. ### +########################################################################### + +class _dummyButton(Button, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + +class _dummyCheckbutton(Checkbutton, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + +class _dummyEntry(Entry, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + +class _dummyFrame(Frame, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + +class _dummyLabel(Label, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + +class _dummyListbox(Listbox, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + +class _dummyMenu(Menu, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + +class _dummyMenubutton(Menubutton, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + +class _dummyScrollbar(Scrollbar, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + +class _dummyText(Text, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + +class _dummyScrolledListBox(ScrolledListBox, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox') + self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') + self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') + +class _dummyHList(HList, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + +class _dummyTList(TList, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + +class _dummyComboBox(ComboBox, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + self.subwidget_list['entry'] = _dummyEntry(self, 'entry') + self.subwidget_list['arrow'] = _dummyButton(self, 'arrow') + self.subwidget_list['slistbox'] = _dummyScrolledListBox(self, + 'slistbox') + self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox', + destroy_physically=0) + +class _dummyDirList(DirList, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') + self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') + self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') + +class _dummyExFileSelectBox(ExFileSelectBox, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + self.subwidget_list['cancel'] = _dummyButton(self, 'cancel') + self.subwidget_list['ok'] = _dummyButton(self, 'ok') + self.subwidget_list['hidden'] = _dummyCheckbutton(self, 'hidden') + self.subwidget_list['types'] = _dummyComboBox(self, 'types') + self.subwidget_list['dir'] = _dummyComboBox(self, 'dir') + self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist') + self.subwidget_list['file'] = _dummyComboBox(self, 'file') + self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist') + +class _dummyFileSelectBox(FileSelectBox, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist') + self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist') + self.subwidget_list['filter'] = _dummyComboBox(self, 'filter') + self.subwidget_list['selection'] = _dummyComboBox(self, 'selection') + +class _dummyStdButtonBox(StdButtonBox, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + self.subwidget_list['ok'] = _dummyButton(self, 'ok') + self.subwidget_list['apply'] = _dummyButton(self, 'apply') + self.subwidget_list['cancel'] = _dummyButton(self, 'cancel') + self.subwidget_list['help'] = _dummyButton(self, 'help') + +class _dummyNoteBookFrame(NoteBookFrame, TixSubWidget): + def __init__(self, master, name, destroy_physically=0): + TixSubWidget.__init__(self, master, name, destroy_physically) + +######################## +### Utility Routines ### +######################## + +# Returns the qualified path name for the widget. Normally used to set +# default options for subwidgets. See tixwidgets.py +def OptionName(widget): + return widget.tk.call('tixOptionName', widget._w) + +# Called with a dictionary argument of the form +# {'*.c':'C source files', '*.txt':'Text Files', '*':'All files'} +# returns a string which can be used to configure the fsbox file types +# in an ExFileSelectBox. i.e., +# '{{*} {* - All files}} {{*.c} {*.c - C source files}} {{*.txt} {*.txt - Text Files}}' +def FileTypeList(dict): + s = '' + for type in dict.keys(): + s = s + '{{' + type + '} {' + type + ' - ' + dict[type] + '}} ' + return s + -- 2.50.0