3434 raise ImportError , "This version of Tix.py requires Tk 4.0 or higher"
3535
3636import _tkinter # If this fails your Python may not be configured for Tk
37- # TixVersion = float(tkinter.TIX_VERSION) # If this fails your Python may not be configured for Tix
38- # WARNING - TixVersion is a limited precision floating point number
3937
4038# Some more constants (for consistency with Tkinter)
4139WINDOW = 'window'
@@ -241,7 +239,7 @@ def grid(self, xsize=0, ysize=0):
241239 for x in y :
242240 z = z + (self .tk .getint (x ),)
243241 return z
244- self .tk .call ('tixForm' , 'grid' , self ._w , xsize , ysize )
242+ return self .tk .call ('tixForm' , 'grid' , self ._w , xsize , ysize )
245243
246244 def info (self , option = None ):
247245 if not option :
@@ -497,6 +495,7 @@ class Balloon(TixWidget):
497495 label Label
498496 message Message"""
499497
498+ # FIXME: It should inherit -superclass tixShell
500499 def __init__ (self , master = None , cnf = {}, ** kw ):
501500 # static seem to be -installcolormap -initwait -statusbar -cursor
502501 static = ['options' , 'installcolormap' , 'initwait' , 'statusbar' ,
@@ -549,6 +548,7 @@ class ComboBox(TixWidget):
549548 tick Button
550549 cross Button : present if created with the fancy option"""
551550
551+ # FIXME: It should inherit -superclass tixLabelWidget
552552 def __init__ (self , master = None , cnf = {}, ** kw ):
553553 TixWidget .__init__ (self , master , 'tixComboBox' ,
554554 ['editable' , 'dropdown' , 'fancy' , 'options' ],
@@ -590,6 +590,7 @@ class Control(TixWidget):
590590 entry Entry
591591 label Label"""
592592
593+ # FIXME: It should inherit -superclass tixLabelWidget
593594 def __init__ (self , master = None , cnf = {}, ** kw ):
594595 TixWidget .__init__ (self , master , 'tixControl' , ['options' ], cnf , kw )
595596 self .subwidget_list ['incr' ] = _dummyButton (self , 'incr' )
@@ -620,6 +621,7 @@ class DirList(TixWidget):
620621 hsb Scrollbar
621622 vsb Scrollbar"""
622623
624+ # FIXME: It should inherit -superclass tixScrolledHList
623625 def __init__ (self , master , cnf = {}, ** kw ):
624626 TixWidget .__init__ (self , master , 'tixDirList' , ['options' ], cnf , kw )
625627 self .subwidget_list ['hlist' ] = _dummyHList (self , 'hlist' )
@@ -641,6 +643,7 @@ class DirTree(TixWidget):
641643 hsb Scrollbar
642644 vsb Scrollbar"""
643645
646+ # FIXME: It should inherit -superclass tixScrolledHList
644647 def __init__ (self , master , cnf = {}, ** kw ):
645648 TixWidget .__init__ (self , master , 'tixDirTree' , ['options' ], cnf , kw )
646649 self .subwidget_list ['hlist' ] = _dummyHList (self , 'hlist' )
@@ -712,6 +715,7 @@ class DirSelectDialog(TixWidget):
712715 ---------- -----
713716 dirbox DirSelectDialog"""
714717
718+ # FIXME: It should inherit -superclass tixDialogShell
715719 def __init__ (self , master , cnf = {}, ** kw ):
716720 TixWidget .__init__ (self , master , 'tixDirSelectDialog' ,
717721 ['options' ], cnf , kw )
@@ -734,6 +738,7 @@ class ExFileSelectDialog(TixWidget):
734738 ---------- -----
735739 fsbox ExFileSelectBox"""
736740
741+ # FIXME: It should inherit -superclass tixDialogShell
737742 def __init__ (self , master , cnf = {}, ** kw ):
738743 TixWidget .__init__ (self , master , 'tixExFileSelectDialog' ,
739744 ['options' ], cnf , kw )
@@ -781,6 +786,7 @@ class FileSelectDialog(TixWidget):
781786 btns StdButtonBox
782787 fsbox FileSelectBox"""
783788
789+ # FIXME: It should inherit -superclass tixStdDialogShell
784790 def __init__ (self , master , cnf = {}, ** kw ):
785791 TixWidget .__init__ (self , master , 'tixFileSelectDialog' ,
786792 ['options' ], cnf , kw )
@@ -804,6 +810,7 @@ class FileEntry(TixWidget):
804810 button Button
805811 entry Entry"""
806812
813+ # FIXME: It should inherit -superclass tixLabelWidget
807814 def __init__ (self , master , cnf = {}, ** kw ):
808815 TixWidget .__init__ (self , master , 'tixFileEntry' ,
809816 ['dialogtype' , 'options' ], cnf , kw )
@@ -814,7 +821,7 @@ def invoke(self):
814821 self .tk .call (self ._w , 'invoke' )
815822
816823 def file_dialog (self ):
817- # XXX return python object
824+ # FIXME: return python object
818825 pass
819826
820827class HList (TixWidget ):
@@ -1003,7 +1010,7 @@ def yview(self, *args):
10031010 apply (self .tk .call , (self ._w , 'yview' ) + args )
10041011
10051012class InputOnly (TixWidget ):
1006- """InputOnly - Invisible widget.
1013+ """InputOnly - Invisible widget. Unix only.
10071014
10081015 Subwidgets - None"""
10091016
@@ -1131,7 +1138,7 @@ def raised(self):
11311138 return self .tk .call (self ._w , 'raised' )
11321139
11331140class NoteBookFrame (TixWidget ):
1134- """Will be added when Tix documentation is available !!!"""
1141+ # FIXME: This is dangerous to expose to be called on its own.
11351142 pass
11361143
11371144class OptionMenu (TixWidget ):
@@ -1223,6 +1230,7 @@ class PopupMenu(TixWidget):
12231230 menubutton Menubutton
12241231 menu Menu"""
12251232
1233+ # FIXME: It should inherit -superclass tixShell
12261234 def __init__ (self , master , cnf = {}, ** kw ):
12271235 TixWidget .__init__ (self , master , 'tixPopupMenu' , ['options' ], cnf , kw )
12281236 self .subwidget_list ['menubutton' ] = _dummyMenubutton (self , 'menubutton' )
@@ -1239,7 +1247,8 @@ def post_widget(self, widget, x, y):
12391247
12401248class ResizeHandle (TixWidget ):
12411249 """Internal widget to draw resize handles on Scrolled widgets."""
1242-
1250+ # FIXME: This is dangerous to expose to be called on its own.
1251+ # Perhaps rename ResizeHandle to _ResizeHandle
12431252 def __init__ (self , master , cnf = {}, ** kw ):
12441253 # There seems to be a Tix bug rejecting the configure method
12451254 # Let's try making the flags -static
@@ -1265,6 +1274,7 @@ def show(self, widget):
12651274class ScrolledHList (TixWidget ):
12661275 """ScrolledHList - HList with automatic scrollbars."""
12671276
1277+ # FIXME: It should inherit -superclass tixScrolledWidget
12681278 def __init__ (self , master , cnf = {}, ** kw ):
12691279 TixWidget .__init__ (self , master , 'tixScrolledHList' , ['options' ],
12701280 cnf , kw )
@@ -1275,6 +1285,7 @@ def __init__(self, master, cnf={}, **kw):
12751285class ScrolledListBox (TixWidget ):
12761286 """ScrolledListBox - Listbox with automatic scrollbars."""
12771287
1288+ # FIXME: It should inherit -superclass tixScrolledWidget
12781289 def __init__ (self , master , cnf = {}, ** kw ):
12791290 TixWidget .__init__ (self , master , 'tixScrolledListBox' , ['options' ], cnf , kw )
12801291 self .subwidget_list ['listbox' ] = _dummyListbox (self , 'listbox' )
@@ -1284,6 +1295,7 @@ def __init__(self, master, cnf={}, **kw):
12841295class ScrolledText (TixWidget ):
12851296 """ScrolledText - Text with automatic scrollbars."""
12861297
1298+ # FIXME: It should inherit -superclass tixScrolledWidget
12871299 def __init__ (self , master , cnf = {}, ** kw ):
12881300 TixWidget .__init__ (self , master , 'tixScrolledText' , ['options' ], cnf , kw )
12891301 self .subwidget_list ['text' ] = _dummyText (self , 'text' )
@@ -1293,6 +1305,7 @@ def __init__(self, master, cnf={}, **kw):
12931305class ScrolledTList (TixWidget ):
12941306 """ScrolledTList - TList with automatic scrollbars."""
12951307
1308+ # FIXME: It should inherit -superclass tixScrolledWidget
12961309 def __init__ (self , master , cnf = {}, ** kw ):
12971310 TixWidget .__init__ (self , master , 'tixScrolledTList' , ['options' ],
12981311 cnf , kw )
@@ -1303,6 +1316,7 @@ def __init__(self, master, cnf={}, **kw):
13031316class ScrolledWindow (TixWidget ):
13041317 """ScrolledWindow - Window with automatic scrollbars."""
13051318
1319+ # FIXME: It should inherit -superclass tixScrolledWidget
13061320 def __init__ (self , master , cnf = {}, ** kw ):
13071321 TixWidget .__init__ (self , master , 'tixScrolledWindow' , ['options' ], cnf , kw )
13081322 self .subwidget_list ['window' ] = _dummyFrame (self , 'window' )
@@ -1315,6 +1329,7 @@ class Select(TixWidget):
13151329
13161330 Subwidgets are buttons added dynamically using the add method."""
13171331
1332+ # FIXME: It should inherit -superclass tixLabelWidget
13181333 def __init__ (self , master , cnf = {}, ** kw ):
13191334 TixWidget .__init__ (self , master , 'tixSelect' ,
13201335 ['allowzero' , 'radio' , 'orientation' , 'labelside' ,
@@ -1347,6 +1362,7 @@ class DialogShell(TixWidget):
13471362
13481363 Subwidgets - None"""
13491364
1365+ # FIXME: It should inherit from Shell
13501366 def __init__ (self ,master = None ,cnf = {}, ** kw ):
13511367 TixWidget .__init__ (self , master ,
13521368 'tixDialogShell' ,
@@ -1474,6 +1490,7 @@ class Tree(TixWidget):
14741490 data in a tree form. The user can adjust
14751491 the view of the tree by opening or closing parts of the tree."""
14761492
1493+ # FIXME: It should inherit -superclass tixScrolledWidget
14771494 def __init__ (self , master = None , cnf = {}, ** kw ):
14781495 TixWidget .__init__ (self , master , 'tixTree' ,
14791496 ['options' ], cnf , kw )
@@ -1482,18 +1499,34 @@ def __init__(self, master=None, cnf={}, **kw):
14821499 self .subwidget_list ['hsb' ] = _dummyScrollbar (self , 'hsb' )
14831500
14841501 def autosetmode (self ):
1502+ '''This command calls the setmode method for all the entries in this
1503+ Tree widget: if an entry has no child entries, its mode is set to
1504+ none. Otherwise, if the entry has any hidden child entries, its mode is
1505+ set to open; otherwise its mode is set to close.'''
14851506 self .tk .call (self ._w , 'autosetmode' )
14861507
14871508 def close (self , entrypath ):
1509+ '''Close the entry given by entryPath if its mode is close.'''
14881510 self .tk .call (self ._w , 'close' , entrypath )
14891511
14901512 def getmode (self , entrypath ):
1513+ '''Returns the current mode of the entry given by entryPath.'''
14911514 return self .tk .call (self ._w , 'getmode' , entrypath )
14921515
14931516 def open (self , entrypath ):
1517+ '''Open the entry given by entryPath if its mode is open.'''
14941518 self .tk .call (self ._w , 'open' , entrypath )
14951519
14961520 def setmode (self , entrypath , mode = 'none' ):
1521+ '''This command is used to indicate whether the entry given by
1522+ entryPath has children entries and whether the children are visible. mode
1523+ must be one of open, close or none. If mode is set to open, a (+)
1524+ indicator is drawn next the the entry. If mode is set to close, a (-)
1525+ indicator is drawn next the the entry. If mode is set to none, no
1526+ indicators will be drawn for this entry. The default mode is none. The
1527+ open mode indicates the entry has hidden children and this entry can be
1528+ opened by the user. The close mode indicates that all the children of the
1529+ entry are now visible and the entry can be closed by the user.'''
14971530 self .tk .call (self ._w , 'setmode' , entrypath , mode )
14981531
14991532
@@ -1504,7 +1537,7 @@ class CheckList(TixWidget):
15041537 similarly to the Tk checkbutton or radiobutton widgets, except it is
15051538 capable of handling many more items than checkbuttons or radiobuttons.
15061539 """
1507-
1540+ # FIXME: It should inherit -superclass tixTree
15081541 def __init__ (self , master = None , cnf = {}, ** kw ):
15091542 TixWidget .__init__ (self , master , 'tixCheckList' ,
15101543 ['options' ], cnf , kw )
@@ -1513,25 +1546,38 @@ def __init__(self, master=None, cnf={}, **kw):
15131546 self .subwidget_list ['hsb' ] = _dummyScrollbar (self , 'hsb' )
15141547
15151548 def autosetmode (self ):
1549+ '''This command calls the setmode method for all the entries in this
1550+ Tree widget: if an entry has no child entries, its mode is set to
1551+ none. Otherwise, if the entry has any hidden child entries, its mode is
1552+ set to open; otherwise its mode is set to close.'''
15161553 self .tk .call (self ._w , 'autosetmode' )
15171554
15181555 def close (self , entrypath ):
1556+ '''Close the entry given by entryPath if its mode is close.'''
15191557 self .tk .call (self ._w , 'close' , entrypath )
15201558
15211559 def getmode (self , entrypath ):
1560+ '''Returns the current mode of the entry given by entryPath.'''
15221561 return self .tk .call (self ._w , 'getmode' , entrypath )
15231562
15241563 def open (self , entrypath ):
1564+ '''Open the entry given by entryPath if its mode is open.'''
15251565 self .tk .call (self ._w , 'open' , entrypath )
15261566
15271567 def getselection (self , mode = 'on' ):
1528- '''Mode can be on, off, default'''
1529- self .tk .call (self ._w , 'getselection' , mode )
1568+ '''Returns a list of items whose status matches status. If status is
1569+ not specified, the list of items in the "on" status will be returned.
1570+ Mode can be on, off, default'''
1571+ c = self .tk .split (self .tk .call (self ._w , 'getselection' , mode ))
1572+ return self .tk .splitlist (c )
15301573
15311574 def getstatus (self , entrypath ):
1532- self .tk .call (self ._w , 'getstatus' , entrypath )
1575+ '''Returns the current status of entryPath.'''
1576+ return self .tk .call (self ._w , 'getstatus' , entrypath )
15331577
15341578 def setstatus (self , entrypath , mode = 'on' ):
1579+ '''Sets the status of entryPath to be status. A bitmap will be
1580+ displayed next to the entry its status is on, off or default.'''
15351581 self .tk .call (self ._w , 'setstatus' , entrypath , mode )
15361582
15371583
@@ -1690,11 +1736,19 @@ def FileTypeList(dict):
16901736 return s
16911737
16921738# Still to be done:
1739+ # tixIconView
16931740class CObjView (TixWidget ):
16941741 """This file implements the Canvas Object View widget. This is a base
16951742 class of IconView. It implements automatic placement/adjustment of the
16961743 scrollbars according to the canvas objects inside the canvas subwidget.
16971744 The scrollbars are adjusted so that the canvas is just large enough
16981745 to see all the objects.
16991746 """
1747+ # FIXME: It should inherit -superclass tixScrolledWidget
1748+ pass
1749+
1750+ class ScrolledGrid (TixWidget ):
1751+ '''Scrolled Grid widgets'''
1752+
1753+ # FIXME: It should inherit -superclass tixScrolledWidget
17001754 pass
0 commit comments