annotate Lib/lib-tk/Tix.py @ 79675:c0a2294de787 2.7

Issue #16199: Backport 2to3 typo fix from 3.2.
author Chris Jerdonek <chris.jerdonek@gmail.com>
date Thu, 11 Oct 2012 16:15:46 -0700
parents 86e3943d0d5b
children cd0191a9b5c9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1 # -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
2 #
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
3 # $Id$
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
4 #
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
5 # Tix.py -- Tix widget wrappers.
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
6 #
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
7 # For Tix, see http://tix.sourceforge.net
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
8 #
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
9 # - Sudhir Shenoy (sshenoy@gol.com), Dec. 1995.
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
10 # based on an idea of Jean-Marc Lugrin (lugrin@ms.com)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
11 #
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
12 # NOTE: In order to minimize changes to Tkinter.py, some of the code here
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
13 # (TixWidget.__init__) has been taken from Tkinter (Widget.__init__)
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
14 # and will break if there are major changes in Tkinter.
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
15 #
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
16 # The Tix widgets are represented by a class hierarchy in python with proper
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
17 # inheritance of base classes.
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
18 #
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
19 # As a result after creating a 'w = StdButtonBox', I can write
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
20 # w.ok['text'] = 'Who Cares'
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
21 # or w.ok['bg'] = w['bg']
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
22 # or even w.ok.invoke()
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
23 # etc.
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
24 #
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
25 # Compare the demo tixwidgets.py to the original Tcl program and you will
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
26 # appreciate the advantages.
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
27 #
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
28
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
29 from Tkinter import *
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
30 from Tkinter import _flatten, _cnfmerge, _default_root
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
31
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
32 # WARNING - TkVersion is a limited precision floating point number
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
33 if TkVersion < 3.999:
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
34 raise ImportError, "This version of Tix.py requires Tk 4.0 or higher"
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
35
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
36 import _tkinter # If this fails your Python may not be configured for Tk
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
37
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
38 # Some more constants (for consistency with Tkinter)
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
39 WINDOW = 'window'
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
40 TEXT = 'text'
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
41 STATUS = 'status'
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
42 IMMEDIATE = 'immediate'
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
43 IMAGE = 'image'
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
44 IMAGETEXT = 'imagetext'
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
45 BALLOON = 'balloon'
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
46 AUTO = 'auto'
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
47 ACROSSTOP = 'acrosstop'
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
48
55691
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
49 # A few useful constants for the Grid widget
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
50 ASCII = 'ascii'
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
51 CELL = 'cell'
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
52 COLUMN = 'column'
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
53 DECREASING = 'decreasing'
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
54 INCREASING = 'increasing'
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
55 INTEGER = 'integer'
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
56 MAIN = 'main'
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
57 MAX = 'max'
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
58 REAL = 'real'
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
59 ROW = 'row'
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
60 S_REGION = 's-region'
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
61 X_REGION = 'x-region'
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
62 Y_REGION = 'y-region'
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
63
21381
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
64 # Some constants used by Tkinter dooneevent()
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
65 TCL_DONT_WAIT = 1 << 1
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
66 TCL_WINDOW_EVENTS = 1 << 2
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
67 TCL_FILE_EVENTS = 1 << 3
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
68 TCL_TIMER_EVENTS = 1 << 4
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
69 TCL_IDLE_EVENTS = 1 << 5
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
70 TCL_ALL_EVENTS = 0
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
71
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
72 # BEWARE - this is implemented by copying some code from the Widget class
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
73 # in Tkinter (to override Widget initialization) and is therefore
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
74 # liable to break.
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
75 import Tkinter, os
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
76
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
77 # Could probably add this to Tkinter.Misc
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
78 class tixCommand:
21381
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
79 """The tix commands provide access to miscellaneous elements
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
80 of Tix's internal state and the Tix application context.
21381
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
81 Most of the information manipulated by these commands pertains
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
82 to the application as a whole, or to a screen or
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
83 display, rather than to a particular window.
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
84
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
85 This is a mixin class, assumed to be mixed to Tkinter.Tk
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
86 that supports the self.tk.call method.
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
87 """
21381
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
88
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
89 def tix_addbitmapdir(self, directory):
21381
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
90 """Tix maintains a list of directories under which
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
91 the tix_getimage and tix_getbitmap commands will
21381
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
92 search for image files. The standard bitmap directory
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
93 is $TIX_LIBRARY/bitmaps. The addbitmapdir command
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
94 adds directory into this list. By using this
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
95 command, the image files of an applications can
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
96 also be located using the tix_getimage or tix_getbitmap
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
97 command.
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
98 """
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
99 return self.tk.call('tix', 'addbitmapdir', directory)
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
100
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
101 def tix_cget(self, option):
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
102 """Returns the current value of the configuration
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
103 option given by option. Option may be any of the
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
104 options described in the CONFIGURATION OPTIONS section.
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
105 """
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
106 return self.tk.call('tix', 'cget', option)
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
107
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
108 def tix_configure(self, cnf=None, **kw):
21381
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
109 """Query or modify the configuration options of the Tix application
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
110 context. If no option is specified, returns a dictionary all of the
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
111 available options. If option is specified with no value, then the
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
112 command returns a list describing the one named option (this list
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
113 will be identical to the corresponding sublist of the value
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
114 returned if no option is specified). If one or more option-value
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
115 pairs are specified, then the command modifies the given option(s)
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
116 to have the given value(s); in this case the command returns an
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
117 empty string. Option may be any of the configuration options.
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
118 """
21381
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
119 # Copied from Tkinter.py
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
120 if kw:
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
121 cnf = _cnfmerge((cnf, kw))
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
122 elif cnf:
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
123 cnf = _cnfmerge(cnf)
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
124 if cnf is None:
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
125 cnf = {}
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
126 for x in self.tk.split(self.tk.call('tix', 'configure')):
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
127 cnf[x[0][1:]] = (x[0][1:],) + x[1:]
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
128 return cnf
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
129 if isinstance(cnf, StringType):
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
130 x = self.tk.split(self.tk.call('tix', 'configure', '-'+cnf))
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
131 return (x[0][1:],) + x[1:]
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
132 return self.tk.call(('tix', 'configure') + self._options(cnf))
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
133
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
134 def tix_filedialog(self, dlgclass=None):
21381
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
135 """Returns the file selection dialog that may be shared among
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
136 different calls from this application. This command will create a
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
137 file selection dialog widget when it is called the first time. This
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
138 dialog will be returned by all subsequent calls to tix_filedialog.
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
139 An optional dlgclass parameter can be passed to specified what type
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
140 of file selection dialog widget is desired. Possible options are
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
141 tix FileSelectDialog or tixExFileSelectDialog.
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
142 """
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
143 if dlgclass is not None:
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
144 return self.tk.call('tix', 'filedialog', dlgclass)
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
145 else:
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
146 return self.tk.call('tix', 'filedialog')
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
147
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
148 def tix_getbitmap(self, name):
21381
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
149 """Locates a bitmap file of the name name.xpm or name in one of the
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
150 bitmap directories (see the tix_addbitmapdir command above). By
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
151 using tix_getbitmap, you can avoid hard coding the pathnames of the
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
152 bitmap files in your application. When successful, it returns the
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
153 complete pathname of the bitmap file, prefixed with the character
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
154 '@'. The returned value can be used to configure the -bitmap
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
155 option of the TK and Tix widgets.
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
156 """
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
157 return self.tk.call('tix', 'getbitmap', name)
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
158
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
159 def tix_getimage(self, name):
21381
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
160 """Locates an image file of the name name.xpm, name.xbm or name.ppm
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
161 in one of the bitmap directories (see the addbitmapdir command
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
162 above). If more than one file with the same name (but different
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
163 extensions) exist, then the image type is chosen according to the
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
164 depth of the X display: xbm images are chosen on monochrome
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
165 displays and color images are chosen on color displays. By using
68503
ee5350f1d0c2 #11515: fix several typos. Patch by Piotr Kasprzyk.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 68256
diff changeset
166 tix_ getimage, you can avoid hard coding the pathnames of the
21381
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
167 image files in your application. When successful, this command
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
168 returns the name of the newly created image, which can be used to
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
169 configure the -image option of the Tk and Tix widgets.
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
170 """
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
171 return self.tk.call('tix', 'getimage', name)
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
172
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
173 def tix_option_get(self, name):
68588
cd8d3c2d3bce #11565: Fix several typos. Patch by Piotr Kasprzyk.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 68503
diff changeset
174 """Gets the options maintained by the Tix
21381
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
175 scheme mechanism. Available options include:
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
176
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
177 active_bg active_fg bg
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
178 bold_font dark1_bg dark1_fg
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
179 dark2_bg dark2_fg disabled_fg
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
180 fg fixed_font font
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
181 inactive_bg inactive_fg input1_bg
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
182 input2_bg italic_font light1_bg
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
183 light1_fg light2_bg light2_fg
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
184 menu_font output1_bg output2_bg
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
185 select_bg select_fg selector
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
186 """
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
187 # could use self.tk.globalgetvar('tixOption', name)
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
188 return self.tk.call('tix', 'option', 'get', name)
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
189
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
190 def tix_resetoptions(self, newScheme, newFontSet, newScmPrio=None):
21381
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
191 """Resets the scheme and fontset of the Tix application to
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
192 newScheme and newFontSet, respectively. This affects only those
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
193 widgets created after this call. Therefore, it is best to call the
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
194 resetoptions command before the creation of any widgets in a Tix
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
195 application.
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
196
21381
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
197 The optional parameter newScmPrio can be given to reset the
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
198 priority level of the Tk options set by the Tix schemes.
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
199
21381
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
200 Because of the way Tk handles the X option database, after Tix has
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
201 been has imported and inited, it is not possible to reset the color
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
202 schemes and font sets using the tix config command. Instead, the
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
203 tix_resetoptions command must be used.
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
204 """
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
205 if newScmPrio is not None:
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
206 return self.tk.call('tix', 'resetoptions', newScheme, newFontSet, newScmPrio)
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
207 else:
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
208 return self.tk.call('tix', 'resetoptions', newScheme, newFontSet)
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
209
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
210 class Tk(Tkinter.Tk, tixCommand):
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
211 """Toplevel widget of Tix which represents mostly the main window
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
212 of an application. It has an associated Tcl interpreter."""
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
213 def __init__(self, screenName=None, baseName=None, className='Tix'):
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
214 Tkinter.Tk.__init__(self, screenName, baseName, className)
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
215 tixlib = os.environ.get('TIX_LIBRARY')
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
216 self.tk.eval('global auto_path; lappend auto_path [file dir [info nameof]]')
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
217 if tixlib is not None:
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
218 self.tk.eval('global auto_path; lappend auto_path {%s}' % tixlib)
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
219 self.tk.eval('global tcl_pkgPath; lappend tcl_pkgPath {%s}' % tixlib)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
220 # Load Tix - this should work dynamically or statically
26910
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
221 # If it's static, tcl/tix8.1/pkgIndex.tcl should have
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
222 # 'load {} Tix'
26910
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
223 # If it's dynamic under Unix, tcl/tix8.1/pkgIndex.tcl should have
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
224 # 'load libtix8.1.8.3.so Tix'
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
225 self.tk.eval('package require Tix')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
226
26910
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
227 def destroy(self):
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
228 # For safety, remove an delete_window binding before destroy
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
229 self.protocol("WM_DELETE_WINDOW", "")
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
230 Tkinter.Tk.destroy(self)
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
231
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
232 # The Tix 'tixForm' geometry manager
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
233 class Form:
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
234 """The Tix Form geometry manager
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
235
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
236 Widgets can be arranged by specifying attachments to other widgets.
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
237 See Tix documentation for complete details"""
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
238
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
239 def config(self, cnf={}, **kw):
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
240 self.tk.call('tixForm', self._w, *self._options(cnf, kw))
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
241
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
242 form = config
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
243
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
244 def __setitem__(self, key, value):
19207
fb153e306152 Fix two bugs discovered by PyChecker. (I cannot test these, but I'm
Guido van Rossum <guido@python.org>
parents: 17106
diff changeset
245 Form.form(self, {key: value})
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
246
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
247 def check(self):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
248 return self.tk.call('tixForm', 'check', self._w)
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
249
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
250 def forget(self):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
251 self.tk.call('tixForm', 'forget', self._w)
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
252
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
253 def grid(self, xsize=0, ysize=0):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
254 if (not xsize) and (not ysize):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
255 x = self.tk.call('tixForm', 'grid', self._w)
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
256 y = self.tk.splitlist(x)
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
257 z = ()
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
258 for x in y:
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
259 z = z + (self.tk.getint(x),)
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
260 return z
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
261 return self.tk.call('tixForm', 'grid', self._w, xsize, ysize)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
262
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
263 def info(self, option=None):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
264 if not option:
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
265 return self.tk.call('tixForm', 'info', self._w)
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
266 if option[0] != '-':
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
267 option = '-' + option
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
268 return self.tk.call('tixForm', 'info', self._w, option)
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
269
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
270 def slaves(self):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
271 return map(self._nametowidget,
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
272 self.tk.splitlist(
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
273 self.tk.call(
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
274 'tixForm', 'slaves', self._w)))
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
275
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
276
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
277
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
278 Tkinter.Widget.__bases__ = Tkinter.Widget.__bases__ + (Form,)
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
279
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
280 class TixWidget(Tkinter.Widget):
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
281 """A TixWidget class is used to package all (or most) Tix widgets.
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
282
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
283 Widget initialization is extended in two ways:
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
284 1) It is possible to give a list of options which must be part of
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
285 the creation command (so called Tix 'static' options). These cannot be
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
286 given as a 'config' command later.
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
287 2) It is possible to give the name of an existing TK widget. These are
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
288 child widgets created automatically by a Tix mega-widget. The Tk call
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
289 to create these widgets is therefore bypassed in TixWidget.__init__
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
290
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
291 Both options are for use by subclasses only.
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
292 """
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
293 def __init__ (self, master=None, widgetName=None,
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
294 static_options=None, cnf={}, kw={}):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
295 # Merge keywords and dictionary arguments
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
296 if kw:
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
297 cnf = _cnfmerge((cnf, kw))
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
298 else:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
299 cnf = _cnfmerge(cnf)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
300
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
301 # Move static options into extra. static_options must be
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
302 # a list of keywords (or None).
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
303 extra=()
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
304
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
305 # 'options' is always a static option
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
306 if static_options:
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
307 static_options.append('options')
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
308 else:
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
309 static_options = ['options']
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
310
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
311 for k,v in cnf.items()[:]:
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
312 if k in static_options:
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
313 extra = extra + ('-' + k, v)
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
314 del cnf[k]
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
315
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
316 self.widgetName = widgetName
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
317 Widget._setup(self, master, cnf)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
318
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
319 # If widgetName is None, this is a dummy creation call where the
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
320 # corresponding Tk widget has already been created by Tix
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
321 if widgetName:
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
322 self.tk.call(widgetName, self._w, *extra)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
323
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
324 # Non-static options - to be done via a 'config' command
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
325 if cnf:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
326 Widget.config(self, cnf)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
327
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
328 # Dictionary to hold subwidget names for easier access. We can't
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
329 # use the children list because the public Tix names may not be the
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
330 # same as the pathname component
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
331 self.subwidget_list = {}
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
332
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
333 # We set up an attribute access function so that it is possible to
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
334 # do w.ok['text'] = 'Hello' rather than w.subwidget('ok')['text'] = 'Hello'
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
335 # when w is a StdButtonBox.
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
336 # We can even do w.ok.invoke() because w.ok is subclassed from the
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
337 # Button class if you go through the proper constructors
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
338 def __getattr__(self, name):
56436
684960fb1cbf replace has_key with 'in' operator
Benjamin Peterson <benjamin@python.org>
parents: 56435
diff changeset
339 if name in self.subwidget_list:
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
340 return self.subwidget_list[name]
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
341 raise AttributeError, name
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
342
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
343 def set_silent(self, value):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
344 """Set a variable without calling its action routine"""
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
345 self.tk.call('tixSetSilent', self._w, value)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
346
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
347 def subwidget(self, name):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
348 """Return the named subwidget (which must have been created by
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
349 the sub-class)."""
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
350 n = self._subwidget_name(name)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
351 if not n:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
352 raise TclError, "Subwidget " + name + " not child of " + self._name
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
353 # Remove header of name and leading dot
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
354 n = n[len(self._w)+1:]
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
355 return self._nametowidget(n)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
356
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
357 def subwidgets_all(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
358 """Return all subwidgets."""
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
359 names = self._subwidget_names()
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
360 if not names:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
361 return []
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
362 retlist = []
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
363 for name in names:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
364 name = name[len(self._w)+1:]
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
365 try:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
366 retlist.append(self._nametowidget(name))
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
367 except:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
368 # some of the widgets are unknown e.g. border in LabelFrame
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
369 pass
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
370 return retlist
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
371
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
372 def _subwidget_name(self,name):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
373 """Get a subwidget name (returns a String, not a Widget !)"""
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
374 try:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
375 return self.tk.call(self._w, 'subwidget', name)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
376 except TclError:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
377 return None
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
378
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
379 def _subwidget_names(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
380 """Return the name of all subwidgets."""
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
381 try:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
382 x = self.tk.call(self._w, 'subwidgets', '-all')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
383 return self.tk.split(x)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
384 except TclError:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
385 return None
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
386
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
387 def config_all(self, option, value):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
388 """Set configuration options for all subwidgets (and self)."""
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
389 if option == '':
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
390 return
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
391 elif not isinstance(option, StringType):
31515
71a294bd7950 Replace backticks with repr() or "%r"
Walter Dörwald <walter@livinglogic.de>
parents: 28513
diff changeset
392 option = repr(option)
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
393 if not isinstance(value, StringType):
31515
71a294bd7950 Replace backticks with repr() or "%r"
Walter Dörwald <walter@livinglogic.de>
parents: 28513
diff changeset
394 value = repr(value)
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
395 names = self._subwidget_names()
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
396 for name in names:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
397 self.tk.call(name, 'configure', '-' + option, value)
26584
4e94aa072768 Upgrade to Tix-8.1.4 from Mike Clarkson (the maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26549
diff changeset
398 # These are missing from Tkinter
4e94aa072768 Upgrade to Tix-8.1.4 from Mike Clarkson (the maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26549
diff changeset
399 def image_create(self, imgtype, cnf={}, master=None, **kw):
4e94aa072768 Upgrade to Tix-8.1.4 from Mike Clarkson (the maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26549
diff changeset
400 if not master:
4e94aa072768 Upgrade to Tix-8.1.4 from Mike Clarkson (the maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26549
diff changeset
401 master = Tkinter._default_root
4e94aa072768 Upgrade to Tix-8.1.4 from Mike Clarkson (the maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26549
diff changeset
402 if not master:
4e94aa072768 Upgrade to Tix-8.1.4 from Mike Clarkson (the maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26549
diff changeset
403 raise RuntimeError, 'Too early to create image'
4e94aa072768 Upgrade to Tix-8.1.4 from Mike Clarkson (the maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26549
diff changeset
404 if kw and cnf: cnf = _cnfmerge((cnf, kw))
4e94aa072768 Upgrade to Tix-8.1.4 from Mike Clarkson (the maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26549
diff changeset
405 elif kw: cnf = kw
4e94aa072768 Upgrade to Tix-8.1.4 from Mike Clarkson (the maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26549
diff changeset
406 options = ()
4e94aa072768 Upgrade to Tix-8.1.4 from Mike Clarkson (the maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26549
diff changeset
407 for k, v in cnf.items():
56435
57ee0793e462 replace callable()
Benjamin Peterson <benjamin@python.org>
parents: 55700
diff changeset
408 if hasattr(v, '__call__'):
26584
4e94aa072768 Upgrade to Tix-8.1.4 from Mike Clarkson (the maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26549
diff changeset
409 v = self._register(v)
4e94aa072768 Upgrade to Tix-8.1.4 from Mike Clarkson (the maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26549
diff changeset
410 options = options + ('-'+k, v)
4e94aa072768 Upgrade to Tix-8.1.4 from Mike Clarkson (the maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26549
diff changeset
411 return master.tk.call(('image', 'create', imgtype,) + options)
4e94aa072768 Upgrade to Tix-8.1.4 from Mike Clarkson (the maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26549
diff changeset
412 def image_delete(self, imgname):
4e94aa072768 Upgrade to Tix-8.1.4 from Mike Clarkson (the maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26549
diff changeset
413 try:
4e94aa072768 Upgrade to Tix-8.1.4 from Mike Clarkson (the maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26549
diff changeset
414 self.tk.call('image', 'delete', imgname)
4e94aa072768 Upgrade to Tix-8.1.4 from Mike Clarkson (the maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26549
diff changeset
415 except TclError:
4e94aa072768 Upgrade to Tix-8.1.4 from Mike Clarkson (the maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26549
diff changeset
416 # May happen if the root was destroyed
4e94aa072768 Upgrade to Tix-8.1.4 from Mike Clarkson (the maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26549
diff changeset
417 pass
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
418
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
419 # Subwidgets are child widgets created automatically by mega-widgets.
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
420 # In python, we have to create these subwidgets manually to mirror their
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
421 # existence in Tk/Tix.
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
422 class TixSubWidget(TixWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
423 """Subwidget class.
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
424
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
425 This is used to mirror child widgets automatically created
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
426 by Tix/Tk as part of a mega-widget in Python (which is not informed
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
427 of this)"""
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
428
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
429 def __init__(self, master, name,
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
430 destroy_physically=1, check_intermediate=1):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
431 if check_intermediate:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
432 path = master._subwidget_name(name)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
433 try:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
434 path = path[len(master._w)+1:]
23601
7e400583755f Use string methods, remove import string
Neal Norwitz <nnorwitz@gmail.com>
parents: 22618
diff changeset
435 plist = path.split('.')
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
436 except:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
437 plist = []
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
438
40354
320dfdee8968 Patch #1472877: Fix Tix subwidget name resolution.
Martin v. Löwis <martin@v.loewis.de>
parents: 38627
diff changeset
439 if not check_intermediate:
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
440 # immediate descendant
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
441 TixWidget.__init__(self, master, None, None, {'name' : name})
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
442 else:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
443 # Ensure that the intermediate widgets exist
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
444 parent = master
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
445 for i in range(len(plist) - 1):
23601
7e400583755f Use string methods, remove import string
Neal Norwitz <nnorwitz@gmail.com>
parents: 22618
diff changeset
446 n = '.'.join(plist[:i+1])
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
447 try:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
448 w = master._nametowidget(n)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
449 parent = w
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
450 except KeyError:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
451 # Create the intermediate widget
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
452 parent = TixSubWidget(parent, plist[i],
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
453 destroy_physically=0,
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
454 check_intermediate=0)
40354
320dfdee8968 Patch #1472877: Fix Tix subwidget name resolution.
Martin v. Löwis <martin@v.loewis.de>
parents: 38627
diff changeset
455 # The Tk widget name is in plist, not in name
320dfdee8968 Patch #1472877: Fix Tix subwidget name resolution.
Martin v. Löwis <martin@v.loewis.de>
parents: 38627
diff changeset
456 if plist:
320dfdee8968 Patch #1472877: Fix Tix subwidget name resolution.
Martin v. Löwis <martin@v.loewis.de>
parents: 38627
diff changeset
457 name = plist[-1]
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
458 TixWidget.__init__(self, parent, None, None, {'name' : name})
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
459 self.destroy_physically = destroy_physically
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
460
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
461 def destroy(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
462 # For some widgets e.g., a NoteBook, when we call destructors,
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
463 # we must be careful not to destroy the frame widget since this
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
464 # also destroys the parent NoteBook thus leading to an exception
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
465 # in Tkinter when it finally calls Tcl to destroy the NoteBook
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
466 for c in self.children.values(): c.destroy()
56436
684960fb1cbf replace has_key with 'in' operator
Benjamin Peterson <benjamin@python.org>
parents: 56435
diff changeset
467 if self._name in self.master.children:
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
468 del self.master.children[self._name]
56436
684960fb1cbf replace has_key with 'in' operator
Benjamin Peterson <benjamin@python.org>
parents: 56435
diff changeset
469 if self._name in self.master.subwidget_list:
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
470 del self.master.subwidget_list[self._name]
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
471 if self.destroy_physically:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
472 # This is bypassed only for a few widgets
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
473 self.tk.call('destroy', self._w)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
474
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
475
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
476 # Useful func. to split Tcl lists and return as a dict. From Tkinter.py
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
477 def _lst2dict(lst):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
478 dict = {}
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
479 for x in lst:
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
480 dict[x[0][1:]] = (x[0][1:],) + x[1:]
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
481 return dict
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
482
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
483 # Useful class to create a display style - later shared by many items.
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
484 # Contributed by Steffen Kremser
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
485 class DisplayStyle:
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
486 """DisplayStyle - handle configuration options shared by
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
487 (multiple) Display Items"""
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
488
38627
98e81af40007 Normalized a few cases of whitespace in function declarations.
Martin Blais <blais@furius.ca>
parents: 37569
diff changeset
489 def __init__(self, itemtype, cnf={}, **kw):
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
490 master = _default_root # global from Tkinter
56436
684960fb1cbf replace has_key with 'in' operator
Benjamin Peterson <benjamin@python.org>
parents: 56435
diff changeset
491 if not master and 'refwindow' in cnf: master=cnf['refwindow']
684960fb1cbf replace has_key with 'in' operator
Benjamin Peterson <benjamin@python.org>
parents: 56435
diff changeset
492 elif not master and 'refwindow' in kw: master= kw['refwindow']
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
493 elif not master: raise RuntimeError, "Too early to create display style: no root window"
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
494 self.tk = master.tk
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
495 self.stylename = self.tk.call('tixDisplayStyle', itemtype,
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
496 *self._options(cnf,kw) )
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
497
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
498 def __str__(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
499 return self.stylename
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
500
38627
98e81af40007 Normalized a few cases of whitespace in function declarations.
Martin Blais <blais@furius.ca>
parents: 37569
diff changeset
501 def _options(self, cnf, kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
502 if kw and cnf:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
503 cnf = _cnfmerge((cnf, kw))
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
504 elif kw:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
505 cnf = kw
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
506 opts = ()
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
507 for k, v in cnf.items():
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
508 opts = opts + ('-'+k, v)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
509 return opts
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
510
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
511 def delete(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
512 self.tk.call(self.stylename, 'delete')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
513
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
514 def __setitem__(self,key,value):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
515 self.tk.call(self.stylename, 'configure', '-%s'%key, value)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
516
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
517 def config(self, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
518 return _lst2dict(
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
519 self.tk.split(
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
520 self.tk.call(
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
521 self.stylename, 'configure', *self._options(cnf,kw))))
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
522
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
523 def __getitem__(self,key):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
524 return self.tk.call(self.stylename, 'cget', '-%s'%key)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
525
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
526
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
527 ######################################################
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
528 ### The Tix Widget classes - in alphabetical order ###
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
529 ######################################################
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
530
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
531 class Balloon(TixWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
532 """Balloon help widget.
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
533
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
534 Subwidget Class
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
535 --------- -----
21381
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
536 label Label
913458eaef90 Make tix_configure() work the same way configure() works for the basic
Fred Drake <fdrake@acm.org>
parents: 21048
diff changeset
537 message Message"""
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
538
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
539 # FIXME: It should inherit -superclass tixShell
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
540 def __init__(self, master=None, cnf={}, **kw):
21048
cd0b75b19df7 Properly set static options for tixBalloon and tixResizeHandle.
Martin v. Löwis <martin@v.loewis.de>
parents: 20854
diff changeset
541 # static seem to be -installcolormap -initwait -statusbar -cursor
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
542 static = ['options', 'installcolormap', 'initwait', 'statusbar',
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
543 'cursor']
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
544 TixWidget.__init__(self, master, 'tixBalloon', static, cnf, kw)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
545 self.subwidget_list['label'] = _dummyLabel(self, 'label',
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
546 destroy_physically=0)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
547 self.subwidget_list['message'] = _dummyLabel(self, 'message',
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
548 destroy_physically=0)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
549
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
550 def bind_widget(self, widget, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
551 """Bind balloon widget to another.
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
552 One balloon widget may be bound to several widgets at the same time"""
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
553 self.tk.call(self._w, 'bind', widget._w, *self._options(cnf, kw))
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
554
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
555 def unbind_widget(self, widget):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
556 self.tk.call(self._w, 'unbind', widget._w)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
557
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
558 class ButtonBox(TixWidget):
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
559 """ButtonBox - A container for pushbuttons.
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
560 Subwidgets are the buttons added with the add method.
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
561 """
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
562 def __init__(self, master=None, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
563 TixWidget.__init__(self, master, 'tixButtonBox',
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
564 ['orientation', 'options'], cnf, kw)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
565
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
566 def add(self, name, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
567 """Add a button with given name to box."""
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
568
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
569 btn = self.tk.call(self._w, 'add', name, *self._options(cnf, kw))
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
570 self.subwidget_list[name] = _dummyButton(self, name)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
571 return btn
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
572
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
573 def invoke(self, name):
56436
684960fb1cbf replace has_key with 'in' operator
Benjamin Peterson <benjamin@python.org>
parents: 56435
diff changeset
574 if name in self.subwidget_list:
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
575 self.tk.call(self._w, 'invoke', name)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
576
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
577 class ComboBox(TixWidget):
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
578 """ComboBox - an Entry field with a dropdown menu. The user can select a
68588
cd8d3c2d3bce #11565: Fix several typos. Patch by Piotr Kasprzyk.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 68503
diff changeset
579 choice by either typing in the entry subwidget or selecting from the
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
580 listbox subwidget.
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
581
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
582 Subwidget Class
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
583 --------- -----
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
584 entry Entry
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
585 arrow Button
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
586 slistbox ScrolledListBox
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
587 tick Button
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
588 cross Button : present if created with the fancy option"""
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
589
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
590 # FIXME: It should inherit -superclass tixLabelWidget
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
591 def __init__ (self, master=None, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
592 TixWidget.__init__(self, master, 'tixComboBox',
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
593 ['editable', 'dropdown', 'fancy', 'options'],
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
594 cnf, kw)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
595 self.subwidget_list['label'] = _dummyLabel(self, 'label')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
596 self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
597 self.subwidget_list['arrow'] = _dummyButton(self, 'arrow')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
598 self.subwidget_list['slistbox'] = _dummyScrolledListBox(self,
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
599 'slistbox')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
600 try:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
601 self.subwidget_list['tick'] = _dummyButton(self, 'tick')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
602 self.subwidget_list['cross'] = _dummyButton(self, 'cross')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
603 except TypeError:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
604 # unavailable when -fancy not specified
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
605 pass
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
606
26584
4e94aa072768 Upgrade to Tix-8.1.4 from Mike Clarkson (the maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26549
diff changeset
607 # align
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
608
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
609 def add_history(self, str):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
610 self.tk.call(self._w, 'addhistory', str)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
611
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
612 def append_history(self, str):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
613 self.tk.call(self._w, 'appendhistory', str)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
614
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
615 def insert(self, index, str):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
616 self.tk.call(self._w, 'insert', index, str)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
617
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
618 def pick(self, index):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
619 self.tk.call(self._w, 'pick', index)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
620
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
621 class Control(TixWidget):
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
622 """Control - An entry field with value change arrows. The user can
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
623 adjust the value by pressing the two arrow buttons or by entering
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
624 the value directly into the entry. The new value will be checked
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
625 against the user-defined upper and lower limits.
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
626
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
627 Subwidget Class
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
628 --------- -----
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
629 incr Button
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
630 decr Button
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
631 entry Entry
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
632 label Label"""
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
633
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
634 # FIXME: It should inherit -superclass tixLabelWidget
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
635 def __init__ (self, master=None, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
636 TixWidget.__init__(self, master, 'tixControl', ['options'], cnf, kw)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
637 self.subwidget_list['incr'] = _dummyButton(self, 'incr')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
638 self.subwidget_list['decr'] = _dummyButton(self, 'decr')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
639 self.subwidget_list['label'] = _dummyLabel(self, 'label')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
640 self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
641
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
642 def decrement(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
643 self.tk.call(self._w, 'decr')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
644
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
645 def increment(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
646 self.tk.call(self._w, 'incr')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
647
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
648 def invoke(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
649 self.tk.call(self._w, 'invoke')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
650
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
651 def update(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
652 self.tk.call(self._w, 'update')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
653
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
654 class DirList(TixWidget):
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
655 """DirList - displays a list view of a directory, its previous
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
656 directories and its sub-directories. The user can choose one of
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
657 the directories displayed in the list or change to another directory.
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
658
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
659 Subwidget Class
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
660 --------- -----
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
661 hlist HList
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
662 hsb Scrollbar
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
663 vsb Scrollbar"""
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
664
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
665 # FIXME: It should inherit -superclass tixScrolledHList
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
666 def __init__(self, master, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
667 TixWidget.__init__(self, master, 'tixDirList', ['options'], cnf, kw)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
668 self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
669 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
670 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
671
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
672 def chdir(self, dir):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
673 self.tk.call(self._w, 'chdir', dir)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
674
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
675 class DirTree(TixWidget):
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
676 """DirTree - Directory Listing in a hierarchical view.
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
677 Displays a tree view of a directory, its previous directories and its
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
678 sub-directories. The user can choose one of the directories displayed
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
679 in the list or change to another directory.
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
680
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
681 Subwidget Class
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
682 --------- -----
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
683 hlist HList
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
684 hsb Scrollbar
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
685 vsb Scrollbar"""
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
686
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
687 # FIXME: It should inherit -superclass tixScrolledHList
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
688 def __init__(self, master, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
689 TixWidget.__init__(self, master, 'tixDirTree', ['options'], cnf, kw)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
690 self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
691 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
692 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
693
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
694 def chdir(self, dir):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
695 self.tk.call(self._w, 'chdir', dir)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
696
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
697 class DirSelectBox(TixWidget):
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
698 """DirSelectBox - Motif style file select box.
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
699 It is generally used for
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
700 the user to choose a file. FileSelectBox stores the files mostly
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
701 recently selected into a ComboBox widget so that they can be quickly
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
702 selected again.
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
703
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
704 Subwidget Class
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
705 --------- -----
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
706 selection ComboBox
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
707 filter ComboBox
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
708 dirlist ScrolledListBox
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
709 filelist ScrolledListBox"""
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
710
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
711 def __init__(self, master, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
712 TixWidget.__init__(self, master, 'tixDirSelectBox', ['options'], cnf, kw)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
713 self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
714 self.subwidget_list['dircbx'] = _dummyFileComboBox(self, 'dircbx')
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
715
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
716 class ExFileSelectBox(TixWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
717 """ExFileSelectBox - MS Windows style file select box.
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
718 It provides an convenient method for the user to select files.
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
719
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
720 Subwidget Class
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
721 --------- -----
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
722 cancel Button
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
723 ok Button
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
724 hidden Checkbutton
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
725 types ComboBox
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
726 dir ComboBox
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
727 file ComboBox
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
728 dirlist ScrolledListBox
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
729 filelist ScrolledListBox"""
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
730
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
731 def __init__(self, master, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
732 TixWidget.__init__(self, master, 'tixExFileSelectBox', ['options'], cnf, kw)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
733 self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
734 self.subwidget_list['ok'] = _dummyButton(self, 'ok')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
735 self.subwidget_list['hidden'] = _dummyCheckbutton(self, 'hidden')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
736 self.subwidget_list['types'] = _dummyComboBox(self, 'types')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
737 self.subwidget_list['dir'] = _dummyComboBox(self, 'dir')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
738 self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
739 self.subwidget_list['file'] = _dummyComboBox(self, 'file')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
740 self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
741
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
742 def filter(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
743 self.tk.call(self._w, 'filter')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
744
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
745 def invoke(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
746 self.tk.call(self._w, 'invoke')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
747
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
748
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
749 # Should inherit from a Dialog class
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
750 class DirSelectDialog(TixWidget):
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
751 """The DirSelectDialog widget presents the directories in the file
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
752 system in a dialog window. The user can use this dialog window to
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
753 navigate through the file system to select the desired directory.
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
754
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
755 Subwidgets Class
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
756 ---------- -----
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
757 dirbox DirSelectDialog"""
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
758
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
759 # FIXME: It should inherit -superclass tixDialogShell
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
760 def __init__(self, master, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
761 TixWidget.__init__(self, master, 'tixDirSelectDialog',
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
762 ['options'], cnf, kw)
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
763 self.subwidget_list['dirbox'] = _dummyDirSelectBox(self, 'dirbox')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
764 # cancel and ok buttons are missing
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
765
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
766 def popup(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
767 self.tk.call(self._w, 'popup')
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
768
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
769 def popdown(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
770 self.tk.call(self._w, 'popdown')
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
771
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
772
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
773 # Should inherit from a Dialog class
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
774 class ExFileSelectDialog(TixWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
775 """ExFileSelectDialog - MS Windows style file select dialog.
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
776 It provides an convenient method for the user to select files.
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
777
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
778 Subwidgets Class
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
779 ---------- -----
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
780 fsbox ExFileSelectBox"""
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
781
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
782 # FIXME: It should inherit -superclass tixDialogShell
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
783 def __init__(self, master, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
784 TixWidget.__init__(self, master, 'tixExFileSelectDialog',
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
785 ['options'], cnf, kw)
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
786 self.subwidget_list['fsbox'] = _dummyExFileSelectBox(self, 'fsbox')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
787
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
788 def popup(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
789 self.tk.call(self._w, 'popup')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
790
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
791 def popdown(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
792 self.tk.call(self._w, 'popdown')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
793
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
794 class FileSelectBox(TixWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
795 """ExFileSelectBox - Motif style file select box.
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
796 It is generally used for
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
797 the user to choose a file. FileSelectBox stores the files mostly
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
798 recently selected into a ComboBox widget so that they can be quickly
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
799 selected again.
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
800
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
801 Subwidget Class
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
802 --------- -----
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
803 selection ComboBox
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
804 filter ComboBox
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
805 dirlist ScrolledListBox
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
806 filelist ScrolledListBox"""
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
807
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
808 def __init__(self, master, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
809 TixWidget.__init__(self, master, 'tixFileSelectBox', ['options'], cnf, kw)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
810 self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
811 self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
812 self.subwidget_list['filter'] = _dummyComboBox(self, 'filter')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
813 self.subwidget_list['selection'] = _dummyComboBox(self, 'selection')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
814
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
815 def apply_filter(self): # name of subwidget is same as command
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
816 self.tk.call(self._w, 'filter')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
817
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
818 def invoke(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
819 self.tk.call(self._w, 'invoke')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
820
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
821 # Should inherit from a Dialog class
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
822 class FileSelectDialog(TixWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
823 """FileSelectDialog - Motif style file select dialog.
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
824
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
825 Subwidgets Class
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
826 ---------- -----
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
827 btns StdButtonBox
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
828 fsbox FileSelectBox"""
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
829
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
830 # FIXME: It should inherit -superclass tixStdDialogShell
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
831 def __init__(self, master, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
832 TixWidget.__init__(self, master, 'tixFileSelectDialog',
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
833 ['options'], cnf, kw)
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
834 self.subwidget_list['btns'] = _dummyStdButtonBox(self, 'btns')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
835 self.subwidget_list['fsbox'] = _dummyFileSelectBox(self, 'fsbox')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
836
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
837 def popup(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
838 self.tk.call(self._w, 'popup')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
839
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
840 def popdown(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
841 self.tk.call(self._w, 'popdown')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
842
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
843 class FileEntry(TixWidget):
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
844 """FileEntry - Entry field with button that invokes a FileSelectDialog.
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
845 The user can type in the filename manually. Alternatively, the user can
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
846 press the button widget that sits next to the entry, which will bring
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
847 up a file selection dialog.
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
848
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
849 Subwidgets Class
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
850 ---------- -----
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
851 button Button
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
852 entry Entry"""
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
853
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
854 # FIXME: It should inherit -superclass tixLabelWidget
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
855 def __init__(self, master, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
856 TixWidget.__init__(self, master, 'tixFileEntry',
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
857 ['dialogtype', 'options'], cnf, kw)
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
858 self.subwidget_list['button'] = _dummyButton(self, 'button')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
859 self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
860
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
861 def invoke(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
862 self.tk.call(self._w, 'invoke')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
863
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
864 def file_dialog(self):
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
865 # FIXME: return python object
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
866 pass
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
867
55640
b7a571d4aaa7 Issue #1135: Add the XView and YView mix-ins to avoid duplicating
Guilherme Polo <ggpolo@gmail.com>
parents: 53736
diff changeset
868 class HList(TixWidget, XView, YView):
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
869 """HList - Hierarchy display widget can be used to display any data
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
870 that have a hierarchical structure, for example, file system directory
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
871 trees. The list entries are indented and connected by branch lines
68588
cd8d3c2d3bce #11565: Fix several typos. Patch by Piotr Kasprzyk.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 68503
diff changeset
872 according to their places in the hierarchy.
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
873
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
874 Subwidgets - None"""
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
875
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
876 def __init__ (self,master=None,cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
877 TixWidget.__init__(self, master, 'tixHList',
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
878 ['columns', 'options'], cnf, kw)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
879
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
880 def add(self, entry, cnf={}, **kw):
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
881 return self.tk.call(self._w, 'add', entry, *self._options(cnf, kw))
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
882
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
883 def add_child(self, parent=None, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
884 if not parent:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
885 parent = ''
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
886 return self.tk.call(
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
887 self._w, 'addchild', parent, *self._options(cnf, kw))
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
888
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
889 def anchor_set(self, entry):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
890 self.tk.call(self._w, 'anchor', 'set', entry)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
891
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
892 def anchor_clear(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
893 self.tk.call(self._w, 'anchor', 'clear')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
894
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
895 def column_width(self, col=0, width=None, chars=None):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
896 if not chars:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
897 return self.tk.call(self._w, 'column', 'width', col, width)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
898 else:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
899 return self.tk.call(self._w, 'column', 'width', col,
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
900 '-char', chars)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
901
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
902 def delete_all(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
903 self.tk.call(self._w, 'delete', 'all')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
904
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
905 def delete_entry(self, entry):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
906 self.tk.call(self._w, 'delete', 'entry', entry)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
907
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
908 def delete_offsprings(self, entry):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
909 self.tk.call(self._w, 'delete', 'offsprings', entry)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
910
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
911 def delete_siblings(self, entry):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
912 self.tk.call(self._w, 'delete', 'siblings', entry)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
913
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
914 def dragsite_set(self, index):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
915 self.tk.call(self._w, 'dragsite', 'set', index)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
916
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
917 def dragsite_clear(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
918 self.tk.call(self._w, 'dragsite', 'clear')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
919
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
920 def dropsite_set(self, index):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
921 self.tk.call(self._w, 'dropsite', 'set', index)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
922
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
923 def dropsite_clear(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
924 self.tk.call(self._w, 'dropsite', 'clear')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
925
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
926 def header_create(self, col, cnf={}, **kw):
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
927 self.tk.call(self._w, 'header', 'create', col, *self._options(cnf, kw))
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
928
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
929 def header_configure(self, col, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
930 if cnf is None:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
931 return _lst2dict(
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
932 self.tk.split(
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
933 self.tk.call(self._w, 'header', 'configure', col)))
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
934 self.tk.call(self._w, 'header', 'configure', col,
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
935 *self._options(cnf, kw))
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
936
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
937 def header_cget(self, col, opt):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
938 return self.tk.call(self._w, 'header', 'cget', col, opt)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
939
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
940 def header_exists(self, col):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
941 return self.tk.call(self._w, 'header', 'exists', col)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
942
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
943 def header_delete(self, col):
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
944 self.tk.call(self._w, 'header', 'delete', col)
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
945
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
946 def header_size(self, col):
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
947 return self.tk.call(self._w, 'header', 'size', col)
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
948
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
949 def hide_entry(self, entry):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
950 self.tk.call(self._w, 'hide', 'entry', entry)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
951
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
952 def indicator_create(self, entry, cnf={}, **kw):
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
953 self.tk.call(
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
954 self._w, 'indicator', 'create', entry, *self._options(cnf, kw))
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
955
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
956 def indicator_configure(self, entry, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
957 if cnf is None:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
958 return _lst2dict(
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
959 self.tk.split(
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
960 self.tk.call(self._w, 'indicator', 'configure', entry)))
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
961 self.tk.call(
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
962 self._w, 'indicator', 'configure', entry, *self._options(cnf, kw))
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
963
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
964 def indicator_cget(self, entry, opt):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
965 return self.tk.call(self._w, 'indicator', 'cget', entry, opt)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
966
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
967 def indicator_exists(self, entry):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
968 return self.tk.call (self._w, 'indicator', 'exists', entry)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
969
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
970 def indicator_delete(self, entry):
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
971 self.tk.call(self._w, 'indicator', 'delete', entry)
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
972
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
973 def indicator_size(self, entry):
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
974 return self.tk.call(self._w, 'indicator', 'size', entry)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
975
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
976 def info_anchor(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
977 return self.tk.call(self._w, 'info', 'anchor')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
978
55698
650df0ec0c12 Issue #1356969: Add missing info methods in Tix.HList.
Guilherme Polo <ggpolo@gmail.com>
parents: 55692
diff changeset
979 def info_bbox(self, entry):
650df0ec0c12 Issue #1356969: Add missing info methods in Tix.HList.
Guilherme Polo <ggpolo@gmail.com>
parents: 55692
diff changeset
980 return self._getints(
650df0ec0c12 Issue #1356969: Add missing info methods in Tix.HList.
Guilherme Polo <ggpolo@gmail.com>
parents: 55692
diff changeset
981 self.tk.call(self._w, 'info', 'bbox', entry)) or None
650df0ec0c12 Issue #1356969: Add missing info methods in Tix.HList.
Guilherme Polo <ggpolo@gmail.com>
parents: 55692
diff changeset
982
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
983 def info_children(self, entry=None):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
984 c = self.tk.call(self._w, 'info', 'children', entry)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
985 return self.tk.splitlist(c)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
986
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
987 def info_data(self, entry):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
988 return self.tk.call(self._w, 'info', 'data', entry)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
989
55698
650df0ec0c12 Issue #1356969: Add missing info methods in Tix.HList.
Guilherme Polo <ggpolo@gmail.com>
parents: 55692
diff changeset
990 def info_dragsite(self):
650df0ec0c12 Issue #1356969: Add missing info methods in Tix.HList.
Guilherme Polo <ggpolo@gmail.com>
parents: 55692
diff changeset
991 return self.tk.call(self._w, 'info', 'dragsite')
650df0ec0c12 Issue #1356969: Add missing info methods in Tix.HList.
Guilherme Polo <ggpolo@gmail.com>
parents: 55692
diff changeset
992
650df0ec0c12 Issue #1356969: Add missing info methods in Tix.HList.
Guilherme Polo <ggpolo@gmail.com>
parents: 55692
diff changeset
993 def info_dropsite(self):
650df0ec0c12 Issue #1356969: Add missing info methods in Tix.HList.
Guilherme Polo <ggpolo@gmail.com>
parents: 55692
diff changeset
994 return self.tk.call(self._w, 'info', 'dropsite')
650df0ec0c12 Issue #1356969: Add missing info methods in Tix.HList.
Guilherme Polo <ggpolo@gmail.com>
parents: 55692
diff changeset
995
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
996 def info_exists(self, entry):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
997 return self.tk.call(self._w, 'info', 'exists', entry)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
998
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
999 def info_hidden(self, entry):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1000 return self.tk.call(self._w, 'info', 'hidden', entry)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1001
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1002 def info_next(self, entry):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1003 return self.tk.call(self._w, 'info', 'next', entry)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1004
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1005 def info_parent(self, entry):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1006 return self.tk.call(self._w, 'info', 'parent', entry)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1007
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1008 def info_prev(self, entry):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1009 return self.tk.call(self._w, 'info', 'prev', entry)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1010
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1011 def info_selection(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1012 c = self.tk.call(self._w, 'info', 'selection')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1013 return self.tk.splitlist(c)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1014
20329
a9763675b74c Add entry parameter to HList.item_cget. Fixes bug #466981.
Martin v. Löwis <martin@v.loewis.de>
parents: 19207
diff changeset
1015 def item_cget(self, entry, col, opt):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1016 return self.tk.call(self._w, 'item', 'cget', entry, col, opt)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1017
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1018 def item_configure(self, entry, col, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1019 if cnf is None:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1020 return _lst2dict(
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1021 self.tk.split(
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1022 self.tk.call(self._w, 'item', 'configure', entry, col)))
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
1023 self.tk.call(self._w, 'item', 'configure', entry, col,
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
1024 *self._options(cnf, kw))
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1025
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1026 def item_create(self, entry, col, cnf={}, **kw):
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
1027 self.tk.call(
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
1028 self._w, 'item', 'create', entry, col, *self._options(cnf, kw))
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1029
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1030 def item_exists(self, entry, col):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1031 return self.tk.call(self._w, 'item', 'exists', entry, col)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1032
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1033 def item_delete(self, entry, col):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1034 self.tk.call(self._w, 'item', 'delete', entry, col)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1035
31730
b967627a2f4f Patch #853488: Add hlist entry_configure and entry_cget methods.
Martin v. Löwis <martin@v.loewis.de>
parents: 31515
diff changeset
1036 def entrycget(self, entry, opt):
b967627a2f4f Patch #853488: Add hlist entry_configure and entry_cget methods.
Martin v. Löwis <martin@v.loewis.de>
parents: 31515
diff changeset
1037 return self.tk.call(self._w, 'entrycget', entry, opt)
b967627a2f4f Patch #853488: Add hlist entry_configure and entry_cget methods.
Martin v. Löwis <martin@v.loewis.de>
parents: 31515
diff changeset
1038
b967627a2f4f Patch #853488: Add hlist entry_configure and entry_cget methods.
Martin v. Löwis <martin@v.loewis.de>
parents: 31515
diff changeset
1039 def entryconfigure(self, entry, cnf={}, **kw):
b967627a2f4f Patch #853488: Add hlist entry_configure and entry_cget methods.
Martin v. Löwis <martin@v.loewis.de>
parents: 31515
diff changeset
1040 if cnf is None:
b967627a2f4f Patch #853488: Add hlist entry_configure and entry_cget methods.
Martin v. Löwis <martin@v.loewis.de>
parents: 31515
diff changeset
1041 return _lst2dict(
b967627a2f4f Patch #853488: Add hlist entry_configure and entry_cget methods.
Martin v. Löwis <martin@v.loewis.de>
parents: 31515
diff changeset
1042 self.tk.split(
b967627a2f4f Patch #853488: Add hlist entry_configure and entry_cget methods.
Martin v. Löwis <martin@v.loewis.de>
parents: 31515
diff changeset
1043 self.tk.call(self._w, 'entryconfigure', entry)))
b967627a2f4f Patch #853488: Add hlist entry_configure and entry_cget methods.
Martin v. Löwis <martin@v.loewis.de>
parents: 31515
diff changeset
1044 self.tk.call(self._w, 'entryconfigure', entry,
b967627a2f4f Patch #853488: Add hlist entry_configure and entry_cget methods.
Martin v. Löwis <martin@v.loewis.de>
parents: 31515
diff changeset
1045 *self._options(cnf, kw))
b967627a2f4f Patch #853488: Add hlist entry_configure and entry_cget methods.
Martin v. Löwis <martin@v.loewis.de>
parents: 31515
diff changeset
1046
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1047 def nearest(self, y):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1048 return self.tk.call(self._w, 'nearest', y)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1049
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1050 def see(self, entry):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1051 self.tk.call(self._w, 'see', entry)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1052
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1053 def selection_clear(self, cnf={}, **kw):
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
1054 self.tk.call(self._w, 'selection', 'clear', *self._options(cnf, kw))
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1055
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1056 def selection_includes(self, entry):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1057 return self.tk.call(self._w, 'selection', 'includes', entry)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1058
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1059 def selection_set(self, first, last=None):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1060 self.tk.call(self._w, 'selection', 'set', first, last)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1061
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1062 def show_entry(self, entry):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1063 return self.tk.call(self._w, 'show', 'entry', entry)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1064
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1065 class InputOnly(TixWidget):
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1066 """InputOnly - Invisible widget. Unix only.
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1067
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1068 Subwidgets - None"""
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1069
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1070 def __init__ (self,master=None,cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1071 TixWidget.__init__(self, master, 'tixInputOnly', None, cnf, kw)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1072
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1073 class LabelEntry(TixWidget):
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1074 """LabelEntry - Entry field with label. Packages an entry widget
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1075 and a label into one mega widget. It can beused be used to simplify
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1076 the creation of ``entry-form'' type of interface.
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1077
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
1078 Subwidgets Class
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
1079 ---------- -----
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
1080 label Label
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
1081 entry Entry"""
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1082
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1083 def __init__ (self,master=None,cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1084 TixWidget.__init__(self, master, 'tixLabelEntry',
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1085 ['labelside','options'], cnf, kw)
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1086 self.subwidget_list['label'] = _dummyLabel(self, 'label')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1087 self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1088
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1089 class LabelFrame(TixWidget):
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1090 """LabelFrame - Labelled Frame container. Packages a frame widget
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1091 and a label into one mega widget. To create widgets inside a
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1092 LabelFrame widget, one creates the new widgets relative to the
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1093 frame subwidget and manage them inside the frame subwidget.
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1094
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
1095 Subwidgets Class
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
1096 ---------- -----
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
1097 label Label
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
1098 frame Frame"""
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1099
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1100 def __init__ (self,master=None,cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1101 TixWidget.__init__(self, master, 'tixLabelFrame',
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1102 ['labelside','options'], cnf, kw)
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1103 self.subwidget_list['label'] = _dummyLabel(self, 'label')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1104 self.subwidget_list['frame'] = _dummyFrame(self, 'frame')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1105
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1106
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1107 class ListNoteBook(TixWidget):
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1108 """A ListNoteBook widget is very similar to the TixNoteBook widget:
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1109 it can be used to display many windows in a limited space using a
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1110 notebook metaphor. The notebook is divided into a stack of pages
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1111 (windows). At one time only one of these pages can be shown.
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1112 The user can navigate through these pages by
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1113 choosing the name of the desired page in the hlist subwidget."""
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1114
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1115 def __init__(self, master, cnf={}, **kw):
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1116 TixWidget.__init__(self, master, 'tixListNoteBook', ['options'], cnf, kw)
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1117 # Is this necessary? It's not an exposed subwidget in Tix.
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1118 self.subwidget_list['pane'] = _dummyPanedWindow(self, 'pane',
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1119 destroy_physically=0)
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1120 self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1121 self.subwidget_list['shlist'] = _dummyScrolledHList(self, 'shlist')
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1122
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1123 def add(self, name, cnf={}, **kw):
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
1124 self.tk.call(self._w, 'add', name, *self._options(cnf, kw))
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1125 self.subwidget_list[name] = TixSubWidget(self, name)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1126 return self.subwidget_list[name]
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1127
25328
a3b295918c5f Patch #484994: Improve PanedWindow.
Martin v. Löwis <martin@v.loewis.de>
parents: 23601
diff changeset
1128 def page(self, name):
32736
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 31730
diff changeset
1129 return self.subwidget(name)
25328
a3b295918c5f Patch #484994: Improve PanedWindow.
Martin v. Löwis <martin@v.loewis.de>
parents: 23601
diff changeset
1130
a3b295918c5f Patch #484994: Improve PanedWindow.
Martin v. Löwis <martin@v.loewis.de>
parents: 23601
diff changeset
1131 def pages(self):
32736
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 31730
diff changeset
1132 # Can't call subwidgets_all directly because we don't want .nbframe
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 31730
diff changeset
1133 names = self.tk.split(self.tk.call(self._w, 'pages'))
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 31730
diff changeset
1134 ret = []
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 31730
diff changeset
1135 for x in names:
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 31730
diff changeset
1136 ret.append(self.subwidget(x))
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 31730
diff changeset
1137 return ret
25328
a3b295918c5f Patch #484994: Improve PanedWindow.
Martin v. Löwis <martin@v.loewis.de>
parents: 23601
diff changeset
1138
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1139 def raise_page(self, name): # raise is a python keyword
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1140 self.tk.call(self._w, 'raise', name)
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1141
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1142 class Meter(TixWidget):
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1143 """The Meter widget can be used to show the progress of a background
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1144 job which may take a long time to execute.
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1145 """
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1146
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1147 def __init__(self, master=None, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1148 TixWidget.__init__(self, master, 'tixMeter',
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1149 ['options'], cnf, kw)
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1150
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1151 class NoteBook(TixWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1152 """NoteBook - Multi-page container widget (tabbed notebook metaphor).
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1153
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
1154 Subwidgets Class
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
1155 ---------- -----
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
1156 nbframe NoteBookFrame
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1157 <pages> page widgets added dynamically with the add method"""
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1158
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1159 def __init__ (self,master=None,cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1160 TixWidget.__init__(self,master,'tixNoteBook', ['options'], cnf, kw)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1161 self.subwidget_list['nbframe'] = TixSubWidget(self, 'nbframe',
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1162 destroy_physically=0)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1163
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1164 def add(self, name, cnf={}, **kw):
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
1165 self.tk.call(self._w, 'add', name, *self._options(cnf, kw))
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1166 self.subwidget_list[name] = TixSubWidget(self, name)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1167 return self.subwidget_list[name]
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1168
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1169 def delete(self, name):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1170 self.tk.call(self._w, 'delete', name)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1171 self.subwidget_list[name].destroy()
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1172 del self.subwidget_list[name]
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1173
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1174 def page(self, name):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1175 return self.subwidget(name)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1176
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1177 def pages(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1178 # Can't call subwidgets_all directly because we don't want .nbframe
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1179 names = self.tk.split(self.tk.call(self._w, 'pages'))
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1180 ret = []
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1181 for x in names:
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1182 ret.append(self.subwidget(x))
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1183 return ret
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1184
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
1185 def raise_page(self, name): # raise is a python keyword
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1186 self.tk.call(self._w, 'raise', name)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1187
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1188 def raised(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1189 return self.tk.call(self._w, 'raised')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1190
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1191 class NoteBookFrame(TixWidget):
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1192 # FIXME: This is dangerous to expose to be called on its own.
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1193 pass
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1194
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1195 class OptionMenu(TixWidget):
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1196 """OptionMenu - creates a menu button of options.
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1197
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
1198 Subwidget Class
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
1199 --------- -----
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1200 menubutton Menubutton
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1201 menu Menu"""
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1202
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1203 def __init__(self, master, cnf={}, **kw):
55700
cd0c8ac9cb49 Added missing static option for OptionMenu. Issue #5961.
Guilherme Polo <ggpolo@gmail.com>
parents: 55698
diff changeset
1204 TixWidget.__init__(self, master, 'tixOptionMenu',
cd0c8ac9cb49 Added missing static option for OptionMenu. Issue #5961.
Guilherme Polo <ggpolo@gmail.com>
parents: 55698
diff changeset
1205 ['labelside', 'options'], cnf, kw)
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1206 self.subwidget_list['menubutton'] = _dummyMenubutton(self, 'menubutton')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1207 self.subwidget_list['menu'] = _dummyMenu(self, 'menu')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1208
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1209 def add_command(self, name, cnf={}, **kw):
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
1210 self.tk.call(self._w, 'add', 'command', name, *self._options(cnf, kw))
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1211
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1212 def add_separator(self, name, cnf={}, **kw):
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
1213 self.tk.call(self._w, 'add', 'separator', name, *self._options(cnf, kw))
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1214
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1215 def delete(self, name):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1216 self.tk.call(self._w, 'delete', name)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1217
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1218 def disable(self, name):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1219 self.tk.call(self._w, 'disable', name)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1220
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1221 def enable(self, name):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1222 self.tk.call(self._w, 'enable', name)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1223
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1224 class PanedWindow(TixWidget):
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1225 """PanedWindow - Multi-pane container widget
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1226 allows the user to interactively manipulate the sizes of several
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1227 panes. The panes can be arranged either vertically or horizontally.The
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1228 user changes the sizes of the panes by dragging the resize handle
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1229 between two panes.
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1230
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
1231 Subwidgets Class
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
1232 ---------- -----
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1233 <panes> g/p widgets added dynamically with the add method."""
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1234
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1235 def __init__(self, master, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1236 TixWidget.__init__(self, master, 'tixPanedWindow', ['orientation', 'options'], cnf, kw)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1237
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1238 # add delete forget panecget paneconfigure panes setsize
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1239 def add(self, name, cnf={}, **kw):
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
1240 self.tk.call(self._w, 'add', name, *self._options(cnf, kw))
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1241 self.subwidget_list[name] = TixSubWidget(self, name,
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1242 check_intermediate=0)
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1243 return self.subwidget_list[name]
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1244
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1245 def delete(self, name):
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1246 self.tk.call(self._w, 'delete', name)
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1247 self.subwidget_list[name].destroy()
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1248 del self.subwidget_list[name]
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1249
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1250 def forget(self, name):
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1251 self.tk.call(self._w, 'forget', name)
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1252
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1253 def panecget(self, entry, opt):
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1254 return self.tk.call(self._w, 'panecget', entry, opt)
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1255
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1256 def paneconfigure(self, entry, cnf={}, **kw):
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1257 if cnf is None:
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1258 return _lst2dict(
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1259 self.tk.split(
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1260 self.tk.call(self._w, 'paneconfigure', entry)))
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
1261 self.tk.call(self._w, 'paneconfigure', entry, *self._options(cnf, kw))
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1262
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1263 def panes(self):
55689
ad930067c124 Issue #1250469: Fix the return value of Tix.PanedWindow.panes.
Guilherme Polo <ggpolo@gmail.com>
parents: 55640
diff changeset
1264 names = self.tk.splitlist(self.tk.call(self._w, 'panes'))
ad930067c124 Issue #1250469: Fix the return value of Tix.PanedWindow.panes.
Guilherme Polo <ggpolo@gmail.com>
parents: 55640
diff changeset
1265 return [self.subwidget(x) for x in names]
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1266
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1267 class PopupMenu(TixWidget):
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1268 """PopupMenu widget can be used as a replacement of the tk_popup command.
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1269 The advantage of the Tix PopupMenu widget is it requires less application
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1270 code to manipulate.
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1271
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1272
17106
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
1273 Subwidgets Class
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
1274 ---------- -----
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
1275 menubutton Menubutton
1823fa231521 Fixed a bunch of Tabnanny errors
Moshe Zadka <moshez@math.huji.ac.il>
parents: 17098
diff changeset
1276 menu Menu"""
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1277
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1278 # FIXME: It should inherit -superclass tixShell
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1279 def __init__(self, master, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1280 TixWidget.__init__(self, master, 'tixPopupMenu', ['options'], cnf, kw)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1281 self.subwidget_list['menubutton'] = _dummyMenubutton(self, 'menubutton')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1282 self.subwidget_list['menu'] = _dummyMenu(self, 'menu')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1283
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1284 def bind_widget(self, widget):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1285 self.tk.call(self._w, 'bind', widget._w)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1286
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1287 def unbind_widget(self, widget):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1288 self.tk.call(self._w, 'unbind', widget._w)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1289
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1290 def post_widget(self, widget, x, y):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1291 self.tk.call(self._w, 'post', widget._w, x, y)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1292
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1293 class ResizeHandle(TixWidget):
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1294 """Internal widget to draw resize handles on Scrolled widgets."""
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1295 def __init__(self, master, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1296 # There seems to be a Tix bug rejecting the configure method
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1297 # Let's try making the flags -static
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1298 flags = ['options', 'command', 'cursorfg', 'cursorbg',
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1299 'handlesize', 'hintcolor', 'hintwidth',
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1300 'x', 'y']
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1301 # In fact, x y height width are configurable
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1302 TixWidget.__init__(self, master, 'tixResizeHandle',
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1303 flags, cnf, kw)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1304
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1305 def attach_widget(self, widget):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1306 self.tk.call(self._w, 'attachwidget', widget._w)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1307
21048
cd0b75b19df7 Properly set static options for tixBalloon and tixResizeHandle.
Martin v. Löwis <martin@v.loewis.de>
parents: 20854
diff changeset
1308 def detach_widget(self, widget):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1309 self.tk.call(self._w, 'detachwidget', widget._w)
21048
cd0b75b19df7 Properly set static options for tixBalloon and tixResizeHandle.
Martin v. Löwis <martin@v.loewis.de>
parents: 20854
diff changeset
1310
cd0b75b19df7 Properly set static options for tixBalloon and tixResizeHandle.
Martin v. Löwis <martin@v.loewis.de>
parents: 20854
diff changeset
1311 def hide(self, widget):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1312 self.tk.call(self._w, 'hide', widget._w)
21048
cd0b75b19df7 Properly set static options for tixBalloon and tixResizeHandle.
Martin v. Löwis <martin@v.loewis.de>
parents: 20854
diff changeset
1313
cd0b75b19df7 Properly set static options for tixBalloon and tixResizeHandle.
Martin v. Löwis <martin@v.loewis.de>
parents: 20854
diff changeset
1314 def show(self, widget):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1315 self.tk.call(self._w, 'show', widget._w)
21048
cd0b75b19df7 Properly set static options for tixBalloon and tixResizeHandle.
Martin v. Löwis <martin@v.loewis.de>
parents: 20854
diff changeset
1316
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1317 class ScrolledHList(TixWidget):
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1318 """ScrolledHList - HList with automatic scrollbars."""
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1319
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1320 # FIXME: It should inherit -superclass tixScrolledWidget
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1321 def __init__(self, master, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1322 TixWidget.__init__(self, master, 'tixScrolledHList', ['options'],
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1323 cnf, kw)
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1324 self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1325 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1326 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1327
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1328 class ScrolledListBox(TixWidget):
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1329 """ScrolledListBox - Listbox with automatic scrollbars."""
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1330
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1331 # FIXME: It should inherit -superclass tixScrolledWidget
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1332 def __init__(self, master, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1333 TixWidget.__init__(self, master, 'tixScrolledListBox', ['options'], cnf, kw)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1334 self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1335 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1336 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1337
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1338 class ScrolledText(TixWidget):
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1339 """ScrolledText - Text with automatic scrollbars."""
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1340
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1341 # FIXME: It should inherit -superclass tixScrolledWidget
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1342 def __init__(self, master, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1343 TixWidget.__init__(self, master, 'tixScrolledText', ['options'], cnf, kw)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1344 self.subwidget_list['text'] = _dummyText(self, 'text')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1345 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1346 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1347
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1348 class ScrolledTList(TixWidget):
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1349 """ScrolledTList - TList with automatic scrollbars."""
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1350
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1351 # FIXME: It should inherit -superclass tixScrolledWidget
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1352 def __init__(self, master, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1353 TixWidget.__init__(self, master, 'tixScrolledTList', ['options'],
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1354 cnf, kw)
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1355 self.subwidget_list['tlist'] = _dummyTList(self, 'tlist')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1356 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1357 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1358
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1359 class ScrolledWindow(TixWidget):
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1360 """ScrolledWindow - Window with automatic scrollbars."""
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1361
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1362 # FIXME: It should inherit -superclass tixScrolledWidget
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1363 def __init__(self, master, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1364 TixWidget.__init__(self, master, 'tixScrolledWindow', ['options'], cnf, kw)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1365 self.subwidget_list['window'] = _dummyFrame(self, 'window')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1366 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1367 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1368
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1369 class Select(TixWidget):
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1370 """Select - Container of button subwidgets. It can be used to provide
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1371 radio-box or check-box style of selection options for the user.
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1372
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1373 Subwidgets are buttons added dynamically using the add method."""
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1374
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1375 # FIXME: It should inherit -superclass tixLabelWidget
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1376 def __init__(self, master, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1377 TixWidget.__init__(self, master, 'tixSelect',
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1378 ['allowzero', 'radio', 'orientation', 'labelside',
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1379 'options'],
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1380 cnf, kw)
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1381 self.subwidget_list['label'] = _dummyLabel(self, 'label')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1382
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1383 def add(self, name, cnf={}, **kw):
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
1384 self.tk.call(self._w, 'add', name, *self._options(cnf, kw))
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1385 self.subwidget_list[name] = _dummyButton(self, name)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1386 return self.subwidget_list[name]
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1387
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1388 def invoke(self, name):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1389 self.tk.call(self._w, 'invoke', name)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1390
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1391 class Shell(TixWidget):
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1392 """Toplevel window.
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1393
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1394 Subwidgets - None"""
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1395
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1396 def __init__ (self,master=None,cnf={}, **kw):
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1397 TixWidget.__init__(self, master, 'tixShell', ['options', 'title'], cnf, kw)
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1398
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1399 class DialogShell(TixWidget):
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1400 """Toplevel window, with popup popdown and center methods.
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1401 It tells the window manager that it is a dialog window and should be
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1402 treated specially. The exact treatment depends on the treatment of
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1403 the window manager.
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1404
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1405 Subwidgets - None"""
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1406
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1407 # FIXME: It should inherit from Shell
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1408 def __init__ (self,master=None,cnf={}, **kw):
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1409 TixWidget.__init__(self, master,
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1410 'tixDialogShell',
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1411 ['options', 'title', 'mapped',
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1412 'minheight', 'minwidth',
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1413 'parent', 'transient'], cnf, kw)
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1414
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1415 def popdown(self):
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1416 self.tk.call(self._w, 'popdown')
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1417
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1418 def popup(self):
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1419 self.tk.call(self._w, 'popup')
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1420
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1421 def center(self):
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1422 self.tk.call(self._w, 'center')
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1423
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1424 class StdButtonBox(TixWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1425 """StdButtonBox - Standard Button Box (OK, Apply, Cancel and Help) """
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1426
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1427 def __init__(self, master=None, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1428 TixWidget.__init__(self, master, 'tixStdButtonBox',
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1429 ['orientation', 'options'], cnf, kw)
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1430 self.subwidget_list['ok'] = _dummyButton(self, 'ok')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1431 self.subwidget_list['apply'] = _dummyButton(self, 'apply')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1432 self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1433 self.subwidget_list['help'] = _dummyButton(self, 'help')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1434
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1435 def invoke(self, name):
56436
684960fb1cbf replace has_key with 'in' operator
Benjamin Peterson <benjamin@python.org>
parents: 56435
diff changeset
1436 if name in self.subwidget_list:
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1437 self.tk.call(self._w, 'invoke', name)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1438
55640
b7a571d4aaa7 Issue #1135: Add the XView and YView mix-ins to avoid duplicating
Guilherme Polo <ggpolo@gmail.com>
parents: 53736
diff changeset
1439 class TList(TixWidget, XView, YView):
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1440 """TList - Hierarchy display widget which can be
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1441 used to display data in a tabular format. The list entries of a TList
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1442 widget are similar to the entries in the Tk listbox widget. The main
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1443 differences are (1) the TList widget can display the list entries in a
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1444 two dimensional format and (2) you can use graphical images as well as
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1445 multiple colors and fonts for the list entries.
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1446
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1447 Subwidgets - None"""
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1448
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1449 def __init__ (self,master=None,cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1450 TixWidget.__init__(self, master, 'tixTList', ['options'], cnf, kw)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1451
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1452 def active_set(self, index):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1453 self.tk.call(self._w, 'active', 'set', index)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1454
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1455 def active_clear(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1456 self.tk.call(self._w, 'active', 'clear')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1457
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1458 def anchor_set(self, index):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1459 self.tk.call(self._w, 'anchor', 'set', index)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1460
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1461 def anchor_clear(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1462 self.tk.call(self._w, 'anchor', 'clear')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1463
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1464 def delete(self, from_, to=None):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1465 self.tk.call(self._w, 'delete', from_, to)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1466
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1467 def dragsite_set(self, index):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1468 self.tk.call(self._w, 'dragsite', 'set', index)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1469
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1470 def dragsite_clear(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1471 self.tk.call(self._w, 'dragsite', 'clear')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1472
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1473 def dropsite_set(self, index):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1474 self.tk.call(self._w, 'dropsite', 'set', index)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1475
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1476 def dropsite_clear(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1477 self.tk.call(self._w, 'dropsite', 'clear')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1478
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1479 def insert(self, index, cnf={}, **kw):
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
1480 self.tk.call(self._w, 'insert', index, *self._options(cnf, kw))
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1481
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1482 def info_active(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1483 return self.tk.call(self._w, 'info', 'active')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1484
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1485 def info_anchor(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1486 return self.tk.call(self._w, 'info', 'anchor')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1487
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1488 def info_down(self, index):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1489 return self.tk.call(self._w, 'info', 'down', index)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1490
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1491 def info_left(self, index):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1492 return self.tk.call(self._w, 'info', 'left', index)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1493
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1494 def info_right(self, index):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1495 return self.tk.call(self._w, 'info', 'right', index)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1496
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1497 def info_selection(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1498 c = self.tk.call(self._w, 'info', 'selection')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1499 return self.tk.splitlist(c)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1500
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1501 def info_size(self):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1502 return self.tk.call(self._w, 'info', 'size')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1503
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1504 def info_up(self, index):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1505 return self.tk.call(self._w, 'info', 'up', index)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1506
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1507 def nearest(self, x, y):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1508 return self.tk.call(self._w, 'nearest', x, y)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1509
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1510 def see(self, index):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1511 self.tk.call(self._w, 'see', index)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1512
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1513 def selection_clear(self, cnf={}, **kw):
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
1514 self.tk.call(self._w, 'selection', 'clear', *self._options(cnf, kw))
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1515
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1516 def selection_includes(self, index):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1517 return self.tk.call(self._w, 'selection', 'includes', index)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1518
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1519 def selection_set(self, first, last=None):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1520 self.tk.call(self._w, 'selection', 'set', first, last)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1521
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1522 class Tree(TixWidget):
68588
cd8d3c2d3bce #11565: Fix several typos. Patch by Piotr Kasprzyk.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 68503
diff changeset
1523 """Tree - The tixTree widget can be used to display hierarchical
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1524 data in a tree form. The user can adjust
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1525 the view of the tree by opening or closing parts of the tree."""
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1526
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1527 # FIXME: It should inherit -superclass tixScrolledWidget
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1528 def __init__(self, master=None, cnf={}, **kw):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1529 TixWidget.__init__(self, master, 'tixTree',
26211
7f870467c182 Sync Tix from Mike Clarkson, a maintainer
Neal Norwitz <nnorwitz@gmail.com>
parents: 25328
diff changeset
1530 ['options'], cnf, kw)
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1531 self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1532 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1533 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1534
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1535 def autosetmode(self):
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1536 '''This command calls the setmode method for all the entries in this
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1537 Tree widget: if an entry has no child entries, its mode is set to
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1538 none. Otherwise, if the entry has any hidden child entries, its mode is
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1539 set to open; otherwise its mode is set to close.'''
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1540 self.tk.call(self._w, 'autosetmode')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1541
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1542 def close(self, entrypath):
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1543 '''Close the entry given by entryPath if its mode is close.'''
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1544 self.tk.call(self._w, 'close', entrypath)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1545
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1546 def getmode(self, entrypath):
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1547 '''Returns the current mode of the entry given by entryPath.'''
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1548 return self.tk.call(self._w, 'getmode', entrypath)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1549
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1550 def open(self, entrypath):
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1551 '''Open the entry given by entryPath if its mode is open.'''
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1552 self.tk.call(self._w, 'open', entrypath)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1553
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1554 def setmode(self, entrypath, mode='none'):
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1555 '''This command is used to indicate whether the entry given by
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1556 entryPath has children entries and whether the children are visible. mode
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1557 must be one of open, close or none. If mode is set to open, a (+)
53736
3088d2ebf7be Merged revisions 72278 via svnmerge from
Walter Dörwald <walter@livinglogic.de>
parents: 47183
diff changeset
1558 indicator is drawn next to the entry. If mode is set to close, a (-)
3088d2ebf7be Merged revisions 72278 via svnmerge from
Walter Dörwald <walter@livinglogic.de>
parents: 47183
diff changeset
1559 indicator is drawn next to the entry. If mode is set to none, no
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1560 indicators will be drawn for this entry. The default mode is none. The
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1561 open mode indicates the entry has hidden children and this entry can be
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1562 opened by the user. The close mode indicates that all the children of the
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1563 entry are now visible and the entry can be closed by the user.'''
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1564 self.tk.call(self._w, 'setmode', entrypath, mode)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1565
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1566
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1567 # Could try subclassing Tree for CheckList - would need another arg to init
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1568 class CheckList(TixWidget):
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1569 """The CheckList widget
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1570 displays a list of items to be selected by the user. CheckList acts
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1571 similarly to the Tk checkbutton or radiobutton widgets, except it is
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1572 capable of handling many more items than checkbuttons or radiobuttons.
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1573 """
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1574 # FIXME: It should inherit -superclass tixTree
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1575 def __init__(self, master=None, cnf={}, **kw):
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1576 TixWidget.__init__(self, master, 'tixCheckList',
55690
37f2f367ad8b Mark the "radio" option of Tix.CheckList as static.
Guilherme Polo <ggpolo@gmail.com>
parents: 55689
diff changeset
1577 ['options', 'radio'], cnf, kw)
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1578 self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1579 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1580 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1581
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1582 def autosetmode(self):
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1583 '''This command calls the setmode method for all the entries in this
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1584 Tree widget: if an entry has no child entries, its mode is set to
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1585 none. Otherwise, if the entry has any hidden child entries, its mode is
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1586 set to open; otherwise its mode is set to close.'''
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1587 self.tk.call(self._w, 'autosetmode')
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1588
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1589 def close(self, entrypath):
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1590 '''Close the entry given by entryPath if its mode is close.'''
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1591 self.tk.call(self._w, 'close', entrypath)
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1592
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1593 def getmode(self, entrypath):
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1594 '''Returns the current mode of the entry given by entryPath.'''
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1595 return self.tk.call(self._w, 'getmode', entrypath)
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1596
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1597 def open(self, entrypath):
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1598 '''Open the entry given by entryPath if its mode is open.'''
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1599 self.tk.call(self._w, 'open', entrypath)
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1600
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1601 def getselection(self, mode='on'):
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1602 '''Returns a list of items whose status matches status. If status is
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1603 not specified, the list of items in the "on" status will be returned.
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1604 Mode can be on, off, default'''
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1605 c = self.tk.split(self.tk.call(self._w, 'getselection', mode))
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1606 return self.tk.splitlist(c)
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1607
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1608 def getstatus(self, entrypath):
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1609 '''Returns the current status of entryPath.'''
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1610 return self.tk.call(self._w, 'getstatus', entrypath)
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1611
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1612 def setstatus(self, entrypath, mode='on'):
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1613 '''Sets the status of entryPath to be status. A bitmap will be
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1614 displayed next to the entry its status is on, off or default.'''
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1615 self.tk.call(self._w, 'setstatus', entrypath, mode)
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1616
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1617
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1618 ###########################################################################
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1619 ### The subclassing below is used to instantiate the subwidgets in each ###
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1620 ### mega widget. This allows us to access their methods directly. ###
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1621 ###########################################################################
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1622
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1623 class _dummyButton(Button, TixSubWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1624 def __init__(self, master, name, destroy_physically=1):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1625 TixSubWidget.__init__(self, master, name, destroy_physically)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1626
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1627 class _dummyCheckbutton(Checkbutton, TixSubWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1628 def __init__(self, master, name, destroy_physically=1):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1629 TixSubWidget.__init__(self, master, name, destroy_physically)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1630
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1631 class _dummyEntry(Entry, TixSubWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1632 def __init__(self, master, name, destroy_physically=1):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1633 TixSubWidget.__init__(self, master, name, destroy_physically)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1634
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1635 class _dummyFrame(Frame, TixSubWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1636 def __init__(self, master, name, destroy_physically=1):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1637 TixSubWidget.__init__(self, master, name, destroy_physically)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1638
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1639 class _dummyLabel(Label, TixSubWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1640 def __init__(self, master, name, destroy_physically=1):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1641 TixSubWidget.__init__(self, master, name, destroy_physically)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1642
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1643 class _dummyListbox(Listbox, TixSubWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1644 def __init__(self, master, name, destroy_physically=1):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1645 TixSubWidget.__init__(self, master, name, destroy_physically)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1646
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1647 class _dummyMenu(Menu, TixSubWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1648 def __init__(self, master, name, destroy_physically=1):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1649 TixSubWidget.__init__(self, master, name, destroy_physically)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1650
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1651 class _dummyMenubutton(Menubutton, TixSubWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1652 def __init__(self, master, name, destroy_physically=1):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1653 TixSubWidget.__init__(self, master, name, destroy_physically)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1654
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1655 class _dummyScrollbar(Scrollbar, TixSubWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1656 def __init__(self, master, name, destroy_physically=1):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1657 TixSubWidget.__init__(self, master, name, destroy_physically)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1658
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1659 class _dummyText(Text, TixSubWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1660 def __init__(self, master, name, destroy_physically=1):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1661 TixSubWidget.__init__(self, master, name, destroy_physically)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1662
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1663 class _dummyScrolledListBox(ScrolledListBox, TixSubWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1664 def __init__(self, master, name, destroy_physically=1):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1665 TixSubWidget.__init__(self, master, name, destroy_physically)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1666 self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1667 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1668 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1669
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1670 class _dummyHList(HList, TixSubWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1671 def __init__(self, master, name, destroy_physically=1):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1672 TixSubWidget.__init__(self, master, name, destroy_physically)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1673
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1674 class _dummyScrolledHList(ScrolledHList, TixSubWidget):
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1675 def __init__(self, master, name, destroy_physically=1):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1676 TixSubWidget.__init__(self, master, name, destroy_physically)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1677 self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1678 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1679 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1680
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1681 class _dummyTList(TList, TixSubWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1682 def __init__(self, master, name, destroy_physically=1):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1683 TixSubWidget.__init__(self, master, name, destroy_physically)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1684
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1685 class _dummyComboBox(ComboBox, TixSubWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1686 def __init__(self, master, name, destroy_physically=1):
26910
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1687 TixSubWidget.__init__(self, master, name, ['fancy',destroy_physically])
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1688 self.subwidget_list['label'] = _dummyLabel(self, 'label')
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1689 self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1690 self.subwidget_list['arrow'] = _dummyButton(self, 'arrow')
26910
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1691
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1692 self.subwidget_list['slistbox'] = _dummyScrolledListBox(self,
26910
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1693 'slistbox')
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1694 try:
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1695 self.subwidget_list['tick'] = _dummyButton(self, 'tick')
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1696 #cross Button : present if created with the fancy option
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1697 self.subwidget_list['cross'] = _dummyButton(self, 'cross')
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1698 except TypeError:
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1699 # unavailable when -fancy not specified
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1700 pass
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1701
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1702 class _dummyDirList(DirList, TixSubWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1703 def __init__(self, master, name, destroy_physically=1):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1704 TixSubWidget.__init__(self, master, name, destroy_physically)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1705 self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1706 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1707 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1708
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1709 class _dummyDirSelectBox(DirSelectBox, TixSubWidget):
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1710 def __init__(self, master, name, destroy_physically=1):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1711 TixSubWidget.__init__(self, master, name, destroy_physically)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1712 self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1713 self.subwidget_list['dircbx'] = _dummyFileComboBox(self, 'dircbx')
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1714
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1715 class _dummyExFileSelectBox(ExFileSelectBox, TixSubWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1716 def __init__(self, master, name, destroy_physically=1):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1717 TixSubWidget.__init__(self, master, name, destroy_physically)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1718 self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1719 self.subwidget_list['ok'] = _dummyButton(self, 'ok')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1720 self.subwidget_list['hidden'] = _dummyCheckbutton(self, 'hidden')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1721 self.subwidget_list['types'] = _dummyComboBox(self, 'types')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1722 self.subwidget_list['dir'] = _dummyComboBox(self, 'dir')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1723 self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1724 self.subwidget_list['file'] = _dummyComboBox(self, 'file')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1725 self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1726
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1727 class _dummyFileSelectBox(FileSelectBox, TixSubWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1728 def __init__(self, master, name, destroy_physically=1):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1729 TixSubWidget.__init__(self, master, name, destroy_physically)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1730 self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1731 self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1732 self.subwidget_list['filter'] = _dummyComboBox(self, 'filter')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1733 self.subwidget_list['selection'] = _dummyComboBox(self, 'selection')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1734
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1735 class _dummyFileComboBox(ComboBox, TixSubWidget):
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1736 def __init__(self, master, name, destroy_physically=1):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1737 TixSubWidget.__init__(self, master, name, destroy_physically)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1738 self.subwidget_list['dircbx'] = _dummyComboBox(self, 'dircbx')
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1739
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1740 class _dummyStdButtonBox(StdButtonBox, TixSubWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1741 def __init__(self, master, name, destroy_physically=1):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1742 TixSubWidget.__init__(self, master, name, destroy_physically)
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1743 self.subwidget_list['ok'] = _dummyButton(self, 'ok')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1744 self.subwidget_list['apply'] = _dummyButton(self, 'apply')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1745 self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1746 self.subwidget_list['help'] = _dummyButton(self, 'help')
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1747
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1748 class _dummyNoteBookFrame(NoteBookFrame, TixSubWidget):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1749 def __init__(self, master, name, destroy_physically=0):
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1750 TixSubWidget.__init__(self, master, name, destroy_physically)
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1751
25328
a3b295918c5f Patch #484994: Improve PanedWindow.
Martin v. Löwis <martin@v.loewis.de>
parents: 23601
diff changeset
1752 class _dummyPanedWindow(PanedWindow, TixSubWidget):
a3b295918c5f Patch #484994: Improve PanedWindow.
Martin v. Löwis <martin@v.loewis.de>
parents: 23601
diff changeset
1753 def __init__(self, master, name, destroy_physically=1):
32736
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 31730
diff changeset
1754 TixSubWidget.__init__(self, master, name, destroy_physically)
25328
a3b295918c5f Patch #484994: Improve PanedWindow.
Martin v. Löwis <martin@v.loewis.de>
parents: 23601
diff changeset
1755
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1756 ########################
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1757 ### Utility Routines ###
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1758 ########################
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1759
26910
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1760 #mike Should tixDestroy be exposed as a wrapper? - but not for widgets.
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1761
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1762 def OptionName(widget):
26910
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1763 '''Returns the qualified path name for the widget. Normally used to set
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1764 default options for subwidgets. See tixwidgets.py'''
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1765 return widget.tk.call('tixOptionName', widget._w)
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1766
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1767 # Called with a dictionary argument of the form
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1768 # {'*.c':'C source files', '*.txt':'Text Files', '*':'All files'}
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1769 # returns a string which can be used to configure the fsbox file types
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1770 # in an ExFileSelectBox. i.e.,
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1771 # '{{*} {* - All files}} {{*.c} {*.c - C source files}} {{*.txt} {*.txt - Text Files}}'
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1772 def FileTypeList(dict):
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1773 s = ''
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1774 for type in dict.keys():
22618
19d4e836bd07 Reindent.
Martin v. Löwis <martin@v.loewis.de>
parents: 22610
diff changeset
1775 s = s + '{{' + type + '} {' + type + ' - ' + dict[type] + '}} '
17098
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1776 return s
989fed28b74f Patch #410231: Add the Python Tix library.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1777
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1778 # Still to be done:
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1779 # tixIconView
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1780 class CObjView(TixWidget):
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1781 """This file implements the Canvas Object View widget. This is a base
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1782 class of IconView. It implements automatic placement/adjustment of the
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1783 scrollbars according to the canvas objects inside the canvas subwidget.
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1784 The scrollbars are adjusted so that the canvas is just large enough
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1785 to see all the objects.
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1786 """
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1787 # FIXME: It should inherit -superclass tixScrolledWidget
20854
0444f576c92b Patch #471120: Improved doc strings and new wrappers.
Martin v. Löwis <martin@v.loewis.de>
parents: 20329
diff changeset
1788 pass
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1789
37560
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1790
55640
b7a571d4aaa7 Issue #1135: Add the XView and YView mix-ins to avoid duplicating
Guilherme Polo <ggpolo@gmail.com>
parents: 53736
diff changeset
1791 class Grid(TixWidget, XView, YView):
26910
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1792 '''The Tix Grid command creates a new window and makes it into a
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1793 tixGrid widget. Additional options, may be specified on the command
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1794 line or in the option database to configure aspects such as its cursor
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1795 and relief.
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1796
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1797 A Grid widget displays its contents in a two dimensional grid of cells.
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1798 Each cell may contain one Tix display item, which may be in text,
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1799 graphics or other formats. See the DisplayStyle class for more information
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1800 about Tix display items. Individual cells, or groups of cells, can be
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1801 formatted with a wide range of attributes, such as its color, relief and
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1802 border.
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1803
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1804 Subwidgets - None'''
37560
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1805 # valid specific resources as of Tk 8.4
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1806 # editdonecmd, editnotifycmd, floatingcols, floatingrows, formatcmd,
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1807 # highlightbackground, highlightcolor, leftmargin, itemtype, selectmode,
37569
b7440ab5cd70 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37560
diff changeset
1808 # selectunit, topmargin,
37560
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1809 def __init__(self, master=None, cnf={}, **kw):
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1810 static= []
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1811 self.cnf= cnf
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1812 TixWidget.__init__(self, master, 'tixGrid', static, cnf, kw)
26910
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1813
37560
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1814 # valid options as of Tk 8.4
55691
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1815 # anchor, bdtype, cget, configure, delete, dragsite, dropsite, entrycget,
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1816 # edit, entryconfigure, format, geometryinfo, info, index, move, nearest,
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1817 # selection, set, size, unset, xview, yview
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1818 def anchor_clear(self):
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1819 """Removes the selection anchor."""
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1820 self.tk.call(self, 'anchor', 'clear')
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1821
37560
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1822 def anchor_get(self):
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1823 "Get the (x,y) coordinate of the current anchor cell"
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1824 return self._getints(self.tk.call(self, 'anchor', 'get'))
37569
b7440ab5cd70 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 37560
diff changeset
1825
55691
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1826 def anchor_set(self, x, y):
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1827 """Set the selection anchor to the cell at (x, y)."""
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1828 self.tk.call(self, 'anchor', 'set', x, y)
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1829
37560
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1830 def delete_row(self, from_, to=None):
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1831 """Delete rows between from_ and to inclusive.
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1832 If to is not provided, delete only row at from_"""
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1833 if to is None:
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1834 self.tk.call(self, 'delete', 'row', from_)
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1835 else:
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1836 self.tk.call(self, 'delete', 'row', from_, to)
55691
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1837
37560
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1838 def delete_column(self, from_, to=None):
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1839 """Delete columns between from_ and to inclusive.
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1840 If to is not provided, delete only column at from_"""
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1841 if to is None:
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1842 self.tk.call(self, 'delete', 'column', from_)
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1843 else:
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1844 self.tk.call(self, 'delete', 'column', from_, to)
55691
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1845
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1846 def edit_apply(self):
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1847 """If any cell is being edited, de-highlight the cell and applies
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1848 the changes."""
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1849 self.tk.call(self, 'edit', 'apply')
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1850
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1851 def edit_set(self, x, y):
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1852 """Highlights the cell at (x, y) for editing, if the -editnotify
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1853 command returns True for this cell."""
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1854 self.tk.call(self, 'edit', 'set', x, y)
37560
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1855
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1856 def entrycget(self, x, y, option):
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1857 "Get the option value for cell at (x,y)"
55692
f8012fdda6d3 Fixes for Tix.Grid from issue #1522587.
Guilherme Polo <ggpolo@gmail.com>
parents: 55691
diff changeset
1858 if option and option[0] != '-':
f8012fdda6d3 Fixes for Tix.Grid from issue #1522587.
Guilherme Polo <ggpolo@gmail.com>
parents: 55691
diff changeset
1859 option = '-' + option
37560
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1860 return self.tk.call(self, 'entrycget', x, y, option)
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1861
55692
f8012fdda6d3 Fixes for Tix.Grid from issue #1522587.
Guilherme Polo <ggpolo@gmail.com>
parents: 55691
diff changeset
1862 def entryconfigure(self, x, y, cnf=None, **kw):
f8012fdda6d3 Fixes for Tix.Grid from issue #1522587.
Guilherme Polo <ggpolo@gmail.com>
parents: 55691
diff changeset
1863 return self._configure(('entryconfigure', x, y), cnf, kw)
f8012fdda6d3 Fixes for Tix.Grid from issue #1522587.
Guilherme Polo <ggpolo@gmail.com>
parents: 55691
diff changeset
1864
26910
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1865 # def format
688fa6cdab94 Tix update from Mike Clarkson (maintainer)
Neal Norwitz <nnorwitz@gmail.com>
parents: 26584
diff changeset
1866 # def index
37560
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1867
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1868 def info_exists(self, x, y):
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1869 "Return True if display item exists at (x,y)"
55692
f8012fdda6d3 Fixes for Tix.Grid from issue #1522587.
Guilherme Polo <ggpolo@gmail.com>
parents: 55691
diff changeset
1870 return self._getboolean(self.tk.call(self, 'info', 'exists', x, y))
37560
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1871
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1872 def info_bbox(self, x, y):
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1873 # This seems to always return '', at least for 'text' displayitems
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1874 return self.tk.call(self, 'info', 'bbox', x, y)
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1875
55691
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1876 def move_column(self, from_, to, offset):
72984
86e3943d0d5b Remove duplication.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 68588
diff changeset
1877 """Moves the range of columns from position FROM through TO by
55691
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1878 the distance indicated by OFFSET. For example, move_column(2, 4, 1)
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1879 moves the columns 2,3,4 to columns 3,4,5."""
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1880 self.tk.call(self, 'move', 'column', from_, to, offset)
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1881
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1882 def move_row(self, from_, to, offset):
72984
86e3943d0d5b Remove duplication.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 68588
diff changeset
1883 """Moves the range of rows from position FROM through TO by
55691
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1884 the distance indicated by OFFSET.
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1885 For example, move_row(2, 4, 1) moves the rows 2,3,4 to rows 3,4,5."""
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1886 self.tk.call(self, 'move', 'row', from_, to, offset)
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1887
37560
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1888 def nearest(self, x, y):
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1889 "Return coordinate of cell nearest pixel coordinate (x,y)"
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1890 return self._getints(self.tk.call(self, 'nearest', x, y))
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1891
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1892 # def selection adjust
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1893 # def selection clear
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1894 # def selection includes
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1895 # def selection set
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1896 # def selection toggle
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1897
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1898 def set(self, x, y, itemtype=None, **kw):
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1899 args= self._options(self.cnf, kw)
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1900 if itemtype is not None:
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1901 args= ('-itemtype', itemtype) + args
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1902 self.tk.call(self, 'set', x, y, *args)
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1903
55691
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1904 def size_column(self, index, **kw):
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1905 """Queries or sets the size of the column given by
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1906 INDEX. INDEX may be any non-negative
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1907 integer that gives the position of a given column.
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1908 INDEX can also be the string "default"; in this case, this command
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1909 queries or sets the default size of all columns.
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1910 When no option-value pair is given, this command returns a tuple
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1911 containing the current size setting of the given column. When
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1912 option-value pairs are given, the corresponding options of the
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1913 size setting of the given column are changed. Options may be one
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1914 of the follwing:
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1915 pad0 pixels
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1916 Specifies the paddings to the left of a column.
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1917 pad1 pixels
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1918 Specifies the paddings to the right of a column.
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1919 size val
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1920 Specifies the width of a column .
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1921 Val may be: "auto" -- the width of the column is set the
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1922 the widest cell in the column; a valid Tk screen distance
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1923 unit; or a real number following by the word chars
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1924 (e.g. 3.4chars) that sets the width of the column to the
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1925 given number of characters."""
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1926 return self.tk.split(self.tk.call(self._w, 'size', 'column', index,
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1927 *self._options({}, kw)))
37560
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1928
55691
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1929 def size_row(self, index, **kw):
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1930 """Queries or sets the size of the row given by
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1931 INDEX. INDEX may be any non-negative
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1932 integer that gives the position of a given row .
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1933 INDEX can also be the string "default"; in this case, this command
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1934 queries or sets the default size of all rows.
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1935 When no option-value pair is given, this command returns a list con-
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1936 taining the current size setting of the given row . When option-value
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1937 pairs are given, the corresponding options of the size setting of the
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1938 given row are changed. Options may be one of the follwing:
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1939 pad0 pixels
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1940 Specifies the paddings to the top of a row.
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1941 pad1 pixels
72984
86e3943d0d5b Remove duplication.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 68588
diff changeset
1942 Specifies the paddings to the bottom of a row.
55691
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1943 size val
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1944 Specifies the height of a row.
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1945 Val may be: "auto" -- the height of the row is set the
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1946 the highest cell in the row; a valid Tk screen distance
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1947 unit; or a real number following by the word chars
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1948 (e.g. 3.4chars) that sets the height of the row to the
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1949 given number of characters."""
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1950 return self.tk.split(self.tk.call(
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1951 self, 'size', 'row', index, *self._options({}, kw)))
28513
90c77b8af1a4 SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents: 26910
diff changeset
1952
55691
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1953 def unset(self, x, y):
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1954 """Clears the cell at (x, y) by removing its display item."""
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1955 self.tk.call(self._w, 'unset', x, y)
cd181a6f4dd7 Issue #1522587: New constants and methods for the Tix.Grid widget.
Guilherme Polo <ggpolo@gmail.com>
parents: 55690
diff changeset
1956
37560
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1957
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1958 class ScrolledGrid(Grid):
26549
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1959 '''Scrolled Grid widgets'''
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1960
8b3601a62336 Patch #649184: Update to tix-8.1.4 RC3.
Martin v. Löwis <martin@v.loewis.de>
parents: 26211
diff changeset
1961 # FIXME: It should inherit -superclass tixScrolledWidget
37560
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1962 def __init__(self, master=None, cnf={}, **kw):
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1963 static= []
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1964 self.cnf= cnf
eb0b9927fffd Patch #1462222: Fix Tix.Grid. Closes #1036406.
Martin v. Löwis <martin@v.loewis.de>
parents: 35850
diff changeset
1965 TixWidget.__init__(self, master, 'tixScrolledGrid', static, cnf, kw)