1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Tkinter.py -- Tk/Tcl widget wrappers
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-06 09:23:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								__version__ = "$Revision$"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1997-02-15 18:33:24 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import _tkinter # If this fails your Python is not configured for Tk
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								tkinter = _tkinter # b/w compat for export
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								TclError = _tkinter.TclError
							 | 
						
					
						
							
								
									
										
										
										
											1995-03-17 16:21:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								from types import *
							 | 
						
					
						
							
								
									
										
										
										
											1995-09-07 19:22:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								from Tkconstants import *
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import string; _string = string; del string
							 | 
						
					
						
							
								
									
										
										
										
											1995-07-14 15:29:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1997-02-15 18:33:24 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								TkVersion = _string.atof(_tkinter.TK_VERSION)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								TclVersion = _string.atof(_tkinter.TCL_VERSION)
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:51:48 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1997-08-05 02:35:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								READABLE = _tkinter.READABLE
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								WRITABLE = _tkinter.WRITABLE
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								EXCEPTION = _tkinter.EXCEPTION
							 | 
						
					
						
							
								
									
										
										
										
											1997-08-14 14:15:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# These are not always defined, e.g. not on Win32 with Tk 8.0 :-(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								try: _tkinter.createfilehandler
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								except AttributeError: _tkinter.createfilehandler = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								try: _tkinter.deletefilehandler
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								except AttributeError: _tkinter.deletefilehandler = None
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 17:11:27 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-06 09:23:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								def _flatten(tuple):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									res = ()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									for item in tuple:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if type(item) in (TupleType, ListType):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											res = res + _flatten(item)
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										elif item is not None:
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-06 09:23:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											res = res + (item,)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									return res
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-06 09:23:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								def _cnfmerge(cnfs):
							 | 
						
					
						
							
								
									
										
										
										
											1995-07-14 15:29:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									if type(cnfs) is DictionaryType:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return cnfs
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									elif type(cnfs) in (NoneType, StringType):
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-06 09:23:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return cnfs
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									else:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										cnf = {}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										for c in _flatten(cnfs):
							 | 
						
					
						
							
								
									
										
										
										
											1997-07-19 20:02:04 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											try:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												cnf.update(c)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											except (AttributeError, TypeError), msg:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												print "_cnfmerge: fallback due to:", msg
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												for k, v in c.items():
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													cnf[k] = v
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-06 09:23:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return cnf
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Event:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									pass
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1998-03-20 20:45:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								_support_default_root = 1
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-06 09:23:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								_default_root = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1998-03-20 20:45:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								def NoDefaultRoot():
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									global _support_default_root
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									_support_default_root = 0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									del _default_root
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-06 09:23:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								def _tkerror(err):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									pass
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-07 13:12:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								def _exit(code='0'):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									raise SystemExit, code
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-07 13:12:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								_varnum = 0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Variable:
							 | 
						
					
						
							
								
									
										
										
										
											1996-09-05 16:45:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									_default = ""
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, master=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										global _varnum
							 | 
						
					
						
							
								
									
										
										
										
											1998-01-14 16:44:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if not master:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											master = _default_root
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self._master = master
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self._tk = master.tk
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self._name = 'PY_VAR' + `_varnum`
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										_varnum = _varnum + 1
							 | 
						
					
						
							
								
									
										
										
										
											1996-09-05 16:45:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.set(self._default)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __del__(self):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self._tk.globalunsetvar(self._name)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __str__(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._name
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def set(self, value):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self._tk.globalsetvar(self._name, value)
							 | 
						
					
						
							
								
									
										
										
										
											1998-01-14 16:44:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def trace_variable(self, mode, callback):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										cbname = self._master._register(callback)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self._tk.call("trace", "variable", self._name, mode, cbname)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return cbname
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									trace = trace_variable
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def trace_vdelete(self, mode, cbname):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self._tk.call("trace", "vdelete", self._name, mode, cbname)
							 | 
						
					
						
							
								
									
										
										
										
											1998-02-19 21:20:30 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self._master.deletecommand(cbname)
							 | 
						
					
						
							
								
									
										
										
										
											1998-01-14 16:44:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def trace_vinfo(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return map(self._tk.split, self._tk.splitlist(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self._tk.call("trace", "vinfo", self._name)))
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class StringVar(Variable):
							 | 
						
					
						
							
								
									
										
										
										
											1996-09-05 16:45:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									_default = ""
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, master=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Variable.__init__(self, master)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def get(self):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self._tk.globalgetvar(self._name)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class IntVar(Variable):
							 | 
						
					
						
							
								
									
										
										
										
											1996-12-27 15:30:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									_default = 0
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, master=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Variable.__init__(self, master)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def get(self):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self._tk.getint(self._tk.globalgetvar(self._name))
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class DoubleVar(Variable):
							 | 
						
					
						
							
								
									
										
										
										
											1996-12-27 15:30:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									_default = 0.0
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, master=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Variable.__init__(self, master)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def get(self):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self._tk.getdouble(self._tk.globalgetvar(self._name))
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class BooleanVar(Variable):
							 | 
						
					
						
							
								
									
										
										
										
											1996-09-05 16:45:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									_default = "false"
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, master=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Variable.__init__(self, master)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def get(self):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self._tk.getboolean(self._tk.globalgetvar(self._name))
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								def mainloop(n=0):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									_default_root.tk.mainloop(n)
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-06 09:23:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								def getint(s):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									return _default_root.tk.getint(s)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								def getdouble(s):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									return _default_root.tk.getdouble(s)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								def getboolean(s):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									return _default_root.tk.getboolean(s)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# Methods defined on both toplevel and interior widgets
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Misc:
							 | 
						
					
						
							
								
									
										
										
										
											1997-12-11 02:03:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									# XXX font command?
							 | 
						
					
						
							
								
									
										
										
										
											1997-05-03 04:16:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									_tclCommands = None
							 | 
						
					
						
							
								
									
										
										
										
											1997-04-14 13:30:24 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def destroy(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if self._tclCommands is not None:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											for name in self._tclCommands:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												#print '- Tkinter: deleted command', name
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												self.tk.deletecommand(name)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self._tclCommands = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def deletecommand(self, name):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										#print '- Tkinter: deleted command', name
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.deletecommand(name)
							 | 
						
					
						
							
								
									
										
										
										
											1997-12-11 02:03:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										try:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self._tclCommands.remove(name)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										except ValueError:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											pass
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tk_strictMotif(self, boolean=None):
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-06 09:23:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self.tk.getboolean(self.tk.call(
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											'set', 'tk_strictMotif', boolean))
							 | 
						
					
						
							
								
									
										
										
										
											1996-09-27 14:06:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def tk_bisque(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('tk_bisque')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tk_setPalette(self, *args, **kw):
							 | 
						
					
						
							
								
									
										
										
										
											1996-10-04 19:23:04 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, ('tk_setPalette',)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										      + _flatten(args) + _flatten(kw.items()))
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def tk_menuBar(self, *args):
							 | 
						
					
						
							
								
									
										
										
										
											1996-09-10 12:39:26 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										pass # obsolete since Tk 4.0
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-06 09:23:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def wait_variable(self, name='PY_VAR'):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('tkwait', 'variable', name)
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-06 09:23:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									waitvar = wait_variable # XXX b/w compat
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 23:15:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def wait_window(self, window=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if window == None:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											window = self
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('tkwait', 'window', window._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def wait_visibility(self, window=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if window == None:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											window = self
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('tkwait', 'visibility', window._w)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def setvar(self, name='PY_VAR', value='1'):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.setvar(name, value)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def getvar(self, name='PY_VAR'):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 08:12:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self.tk.getvar(name)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def getint(self, s):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(s)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 09:09:51 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def getdouble(self, s):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getdouble(s)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def getboolean(self, s):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getboolean(s)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 12:19:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def focus_set(self):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('focus', self._w)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 12:19:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									focus = focus_set # XXX b/w compat?
							 | 
						
					
						
							
								
									
										
										
										
											1996-09-27 14:06:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def focus_force(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('focus', '-force', self._w)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 12:19:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def focus_get(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										name = self.tk.call('focus')
							 | 
						
					
						
							
								
									
										
										
										
											1996-08-08 18:31:42 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if name == 'none' or not name: return None
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 12:19:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self._nametowidget(name)
							 | 
						
					
						
							
								
									
										
										
										
											1996-09-27 14:06:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def focus_displayof(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										name = self.tk.call('focus', '-displayof', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if name == 'none' or not name: return None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._nametowidget(name)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def focus_lastfor(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										name = self.tk.call('focus', '-lastfor', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if name == 'none' or not name: return None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._nametowidget(name)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tk_focusFollowsMouse(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('tk_focusFollowsMouse')
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def tk_focusNext(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										name = self.tk.call('tk_focusNext', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if not name: return None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._nametowidget(name)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tk_focusPrev(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										name = self.tk.call('tk_focusPrev', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if not name: return None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._nametowidget(name)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def after(self, ms, func=None, *args):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if not func:
							 | 
						
					
						
							
								
									
										
										
										
											1995-09-30 17:05:26 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											# I'd rather use time.sleep(ms*0.001)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('after', ms)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										else:
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-21 11:44:21 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											# XXX Disgusting hack to clean up after calling func
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											tmp = []
							 | 
						
					
						
							
								
									
										
										
										
											1997-04-14 13:30:24 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											def callit(func=func, args=args, self=self, tmp=tmp):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-21 11:44:21 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
												try:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													apply(func, args)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												finally:
							 | 
						
					
						
							
								
									
										
										
										
											1997-04-14 13:30:24 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
													self.deletecommand(tmp[0])
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-21 11:44:21 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											name = self._register(callit)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											tmp.append(name)
							 | 
						
					
						
							
								
									
										
										
										
											1995-09-30 17:05:26 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											return self.tk.call('after', ms, name)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def after_idle(self, func, *args):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return apply(self.after, ('idle', func) + args)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def after_cancel(self, id):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('after', 'cancel', id)
							 | 
						
					
						
							
								
									
										
										
										
											1996-09-27 14:06:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def bell(self, displayof=0):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, ('bell',) + self._displayof(displayof))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									# Clipboard handling:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def clipboard_clear(self, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if not kw.has_key('displayof'): kw['displayof'] = self._w
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										      ('clipboard', 'clear') + self._options(kw))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def clipboard_append(self, string, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if not kw.has_key('displayof'): kw['displayof'] = self._w
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										      ('clipboard', 'append') + self._options(kw)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										      + ('--', string))
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 12:19:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									# XXX grab current w/o window argument
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def grab_current(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										name = self.tk.call('grab', 'current', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if not name: return None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._nametowidget(name)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def grab_release(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('grab', 'release', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def grab_set(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('grab', 'set', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def grab_set_global(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('grab', 'set', '-global', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def grab_status(self):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 12:19:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										status = self.tk.call('grab', 'status', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if status == 'none': status = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return status
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def lower(self, belowThis=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('lower', self._w, belowThis)
							 | 
						
					
						
							
								
									
										
										
										
											1994-10-20 22:02:27 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def option_add(self, pattern, value, priority = None):
							 | 
						
					
						
							
								
									
										
										
										
											1995-09-30 17:05:26 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.tk.call('option', 'add', pattern, value, priority)
							 | 
						
					
						
							
								
									
										
										
										
											1994-10-20 22:02:27 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def option_clear(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('option', 'clear')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def option_get(self, name, className):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('option', 'get', self._w, name, className)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def option_readfile(self, fileName, priority = None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('option', 'readfile', fileName, priority)
							 | 
						
					
						
							
								
									
										
										
										
											1996-09-27 14:06:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def selection_clear(self, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if not kw.has_key('displayof'): kw['displayof'] = self._w
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, ('selection', 'clear') + self._options(kw))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def selection_get(self, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if not kw.has_key('displayof'): kw['displayof'] = self._w
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return apply(self.tk.call,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											     ('selection', 'get') + self._options(kw))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def selection_handle(self, command, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										name = self._register(command)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										      ('selection', 'handle') + self._options(kw)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										      + (self._w, name))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def selection_own(self, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										"Become owner of X selection."
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										      ('selection', 'own') + self._options(kw) + (self._w,))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def selection_own_get(self, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										"Find owner of X selection."
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if not kw.has_key('displayof'): kw['displayof'] = self._w
							 | 
						
					
						
							
								
									
										
										
										
											1997-01-21 23:22:03 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										name = apply(self.tk.call,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											     ('selection', 'own') + self._options(kw))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if not name: return None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._nametowidget(name)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def send(self, interp, cmd, *args):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return apply(self.tk.call, ('send', interp, cmd) + args)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 08:12:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def lower(self, belowThis=None):
							 | 
						
					
						
							
								
									
										
										
										
											1996-09-11 14:25:41 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.tk.call('lower', self._w, belowThis)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 08:12:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def tkraise(self, aboveThis=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('raise', self._w, aboveThis)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									lift = tkraise
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def colormodel(self, value=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('tk', 'colormodel', self._w, value)
							 | 
						
					
						
							
								
									
										
										
										
											1996-09-27 14:06:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def winfo_atom(self, name, displayof=0):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										args = ('winfo', 'atom') + self._displayof(displayof) + (name,)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(apply(self.tk.call, args))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_atomname(self, id, displayof=0):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										args = ('winfo', 'atomname') \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										       + self._displayof(displayof) + (id,)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return apply(self.tk.call, args)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_cells(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'cells', self._w))
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 12:19:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def winfo_children(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return map(self._nametowidget,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											   self.tk.splitlist(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												   'winfo', 'children', self._w)))
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_class(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('winfo', 'class', self._w)
							 | 
						
					
						
							
								
									
										
										
										
											1996-09-27 14:06:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def winfo_colormapfull(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getboolean(
							 | 
						
					
						
							
								
									
										
										
										
											1996-12-12 16:43:05 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'colormapfull', self._w))
							 | 
						
					
						
							
								
									
										
										
										
											1996-09-27 14:06:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def winfo_containing(self, rootX, rootY, displayof=0):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										args = ('winfo', 'containing') \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										       + self._displayof(displayof) + (rootX, rootY)
							 | 
						
					
						
							
								
									
										
										
										
											1996-12-12 16:43:05 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										name = apply(self.tk.call, args)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if not name: return None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._nametowidget(name)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_depth(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(self.tk.call('winfo', 'depth', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_exists(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'exists', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_fpixels(self, number):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getdouble(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											'winfo', 'fpixels', self._w, number))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_geometry(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('winfo', 'geometry', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_height(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'height', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_id(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'id', self._w))
							 | 
						
					
						
							
								
									
										
										
										
											1996-09-27 14:06:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def winfo_interps(self, displayof=0):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										args = ('winfo', 'interps') + self._displayof(displayof)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.splitlist(apply(self.tk.call, args))
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_ismapped(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'ismapped', self._w))
							 | 
						
					
						
							
								
									
										
										
										
											1996-12-12 16:43:05 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def winfo_manager(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('winfo', 'manager', self._w)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_name(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('winfo', 'name', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_parent(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('winfo', 'parent', self._w)
							 | 
						
					
						
							
								
									
										
										
										
											1996-09-27 14:06:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def winfo_pathname(self, id, displayof=0):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										args = ('winfo', 'pathname') \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										       + self._displayof(displayof) + (id,)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return apply(self.tk.call, args)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_pixels(self, number):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'pixels', self._w, number))
							 | 
						
					
						
							
								
									
										
										
										
											1996-12-12 16:43:05 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def winfo_pointerx(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'pointerx', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_pointerxy(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._getints(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'pointerxy', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_pointery(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'pointery', self._w))
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_reqheight(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'reqheight', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_reqwidth(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'reqwidth', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_rgb(self, color):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._getints(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'rgb', self._w, color))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_rootx(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'rootx', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_rooty(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'rooty', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_screen(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('winfo', 'screen', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_screencells(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'screencells', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_screendepth(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'screendepth', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_screenheight(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'screenheight', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_screenmmheight(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'screenmmheight', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_screenmmwidth(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'screenmmwidth', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_screenvisual(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('winfo', 'screenvisual', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_screenwidth(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'screenwidth', self._w))
							 | 
						
					
						
							
								
									
										
										
										
											1996-12-12 16:43:05 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def winfo_server(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('winfo', 'server', self._w)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_toplevel(self):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self._nametowidget(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											'winfo', 'toplevel', self._w))
							 | 
						
					
						
							
								
									
										
										
										
											1996-12-12 16:43:05 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def winfo_viewable(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'viewable', self._w))
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_visual(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('winfo', 'visual', self._w)
							 | 
						
					
						
							
								
									
										
										
										
											1996-12-12 16:43:05 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def winfo_visualid(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('winfo', 'visualid', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_visualsavailable(self, includeids=0):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										data = self.tk.split(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'visualsavailable', self._w,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												     includeids and 'includeids' or None))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										def parseitem(x, self=self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return x[:1] + tuple(map(self.tk.getint, x[1:]))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return map(parseitem, data)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_vrootheight(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'vrootheight', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_vrootwidth(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'vrootwidth', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_vrootx(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'vrootx', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_vrooty(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'vrooty', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_width(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'width', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_x(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'x', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def winfo_y(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('winfo', 'y', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def update(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('update')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def update_idletasks(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('update', 'idletasks')
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def bindtags(self, tagList=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if tagList is None:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return self.tk.splitlist(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												self.tk.call('bindtags', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										else:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('bindtags', self._w, tagList)
							 | 
						
					
						
							
								
									
										
										
										
											1997-12-11 02:03:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def _bind(self, what, sequence, func, add, needcleanup=1):
							 | 
						
					
						
							
								
									
										
										
										
											1995-07-14 15:29:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if func:
							 | 
						
					
						
							
								
									
										
										
										
											1998-03-27 21:26:51 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											funcid = self._register(func, self._substitute,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
														needcleanup)
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											cmd = ("%sset _tkinter_break [%s %s]\n"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											       'if {"$_tkinter_break" == "break"} break\n') \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											       % (add and '+' or '',
							 | 
						
					
						
							
								
									
										
										
										
											1998-03-27 21:26:51 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
												  funcid,
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
												  _string.join(self._subst_format))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											apply(self.tk.call, what + (sequence, cmd))
							 | 
						
					
						
							
								
									
										
										
										
											1998-03-27 21:26:51 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											return funcid
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										elif func == '':
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											apply(self.tk.call, what + (sequence, func))
							 | 
						
					
						
							
								
									
										
										
										
											1995-07-14 15:29:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										else:
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											return apply(self.tk.call, what + (sequence,))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def bind(self, sequence=None, func=None, add=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._bind(('bind', self._w), sequence, func, add)
							 | 
						
					
						
							
								
									
										
										
										
											1998-03-27 21:26:51 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def unbind(self, sequence, funcid=None):
							 | 
						
					
						
							
								
									
										
										
										
											1994-08-08 12:47:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.tk.call('bind', self._w, sequence, '')
							 | 
						
					
						
							
								
									
										
										
										
											1998-03-27 21:26:51 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if funcid:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.deletecommand(funcid)
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def bind_all(self, sequence=None, func=None, add=None):
							 | 
						
					
						
							
								
									
										
										
										
											1997-12-11 02:03:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self._bind(('bind', 'all'), sequence, func, add, 0)
							 | 
						
					
						
							
								
									
										
										
										
											1995-07-14 15:29:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def unbind_all(self, sequence):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('bind', 'all' , sequence, '')
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def bind_class(self, className, sequence=None, func=None, add=None):
							 | 
						
					
						
							
								
									
										
										
										
											1997-12-11 02:03:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self._bind(('bind', className), sequence, func, add, 0)
							 | 
						
					
						
							
								
									
										
										
										
											1995-07-14 15:29:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def unbind_class(self, className, sequence):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('bind', className , sequence, '')
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def mainloop(self, n=0):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.mainloop(n)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def quit(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.quit()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def _getints(self, string):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 12:19:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if not string: return None
							 | 
						
					
						
							
								
									
										
										
										
											1995-03-17 16:21:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return tuple(map(self.tk.getint, self.tk.splitlist(string)))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def _getdoubles(self, string):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if not string: return None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return tuple(map(self.tk.getdouble, self.tk.splitlist(string)))
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def _getboolean(self, string):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if string:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return self.tk.getboolean(string)
							 | 
						
					
						
							
								
									
										
										
										
											1996-09-27 14:06:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def _displayof(self, displayof):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if displayof:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return ('-displayof', displayof)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if displayof is None:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return ('-displayof', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return ()
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def _options(self, cnf, kw = None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if kw:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											cnf = _cnfmerge((cnf, kw))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										else:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											cnf = _cnfmerge(cnf)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										res = ()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										for k, v in cnf.items():
							 | 
						
					
						
							
								
									
										
										
										
											1996-09-27 14:06:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											if v is not None:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												if k[-1] == '_': k = k[:-1]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												if callable(v):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													v = self._register(v)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												res = res + ('-'+k, v)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return res
							 | 
						
					
						
							
								
									
										
										
										
											1997-12-12 00:09:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def nametowidget(self, name):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 12:19:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										w = self
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if name[0] == '.':
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											w = w._root()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											name = name[1:]
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										find = _string.find
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 12:19:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										while name:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											i = find(name, '.')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											if i >= 0:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												name, tail = name[:i], name[i+1:]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											else:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												tail = ''
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											w = w.children[name]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											name = tail
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return w
							 | 
						
					
						
							
								
									
										
										
										
											1997-12-12 00:09:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									_nametowidget = nametowidget
							 | 
						
					
						
							
								
									
										
										
										
											1997-12-11 02:03:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def _register(self, func, subst=None, needcleanup=1):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										f = CallWrapper(func, subst, self).__call__
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										name = `id(f)`
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										try:
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											func = func.im_func
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										except AttributeError:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											pass
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										try:
							 | 
						
					
						
							
								
									
										
										
										
											1995-09-07 19:22:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											name = name + func.__name__
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										except AttributeError:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											pass
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.createcommand(name, f)
							 | 
						
					
						
							
								
									
										
										
										
											1997-12-11 02:03:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if needcleanup:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											if self._tclCommands is None:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												self._tclCommands = []
							 | 
						
					
						
							
								
									
										
										
										
											1998-03-20 20:45:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											self._tclCommands.append(name)
							 | 
						
					
						
							
								
									
										
										
										
											1997-04-14 13:30:24 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										#print '+ Tkinter created command', name
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return name
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 23:15:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									register = _register
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 12:19:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def _root(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										w = self
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										while w.master: w = w.master
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return w
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									_subst_format = ('%#', '%b', '%f', '%h', '%k', 
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 12:19:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											 '%s', '%t', '%w', '%x', '%y',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											 '%A', '%E', '%K', '%N', '%W', '%T', '%X', '%Y')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def _substitute(self, *args):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										tk = self.tk
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if len(args) != len(self._subst_format): return args
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 12:19:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										nsign, b, f, h, k, s, t, w, x, y, A, E, K, N, W, T, X, Y = args
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										# Missing: (a, c, d, m, o, v, B, R)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										e = Event()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										e.serial = tk.getint(nsign)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										e.num = tk.getint(b)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										try: e.focus = tk.getboolean(f)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										except TclError: pass
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										e.height = tk.getint(h)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										e.keycode = tk.getint(k)
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 17:11:27 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										# For Visibility events, event state is a string and
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										# not an integer:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										try:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											e.state = tk.getint(s)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										except TclError:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											e.state = s
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 12:19:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										e.time = tk.getint(t)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										e.width = tk.getint(w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										e.x = tk.getint(x)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										e.y = tk.getint(y)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										e.char = A
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										try: e.send_event = tk.getboolean(E)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										except TclError: pass
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										e.keysym = K
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										e.keysym_num = tk.getint(N)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										e.type = T
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										e.widget = self._nametowidget(W)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										e.x_root = tk.getint(X)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										e.y_root = tk.getint(Y)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return (e,)
							 | 
						
					
						
							
								
									
										
										
										
											1995-09-07 19:22:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def _report_exception(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										import sys
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										exc, val, tb = sys.exc_type, sys.exc_value, sys.exc_traceback
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										root = self._root()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										root.report_callback_exception(exc, val, tb)
							 | 
						
					
						
							
								
									
										
										
										
											1997-09-29 23:24:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									# These used to be defined in Widget:
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def configure(self, cnf=None, **kw):
							 | 
						
					
						
							
								
									
										
										
										
											1997-09-29 23:24:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										# XXX ought to generalize this so tag_config etc. can use it
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if kw:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											cnf = _cnfmerge((cnf, kw))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										elif cnf:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											cnf = _cnfmerge(cnf)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if cnf is None:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											cnf = {}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											for x in self.tk.split(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												self.tk.call(self._w, 'configure')):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												cnf[x[0][1:]] = (x[0][1:],) + x[1:]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return cnf
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if type(cnf) is StringType:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											x = self.tk.split(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												self._w, 'configure', '-'+cnf))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return (x[0][1:],) + x[1:]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, (self._w, 'configure')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										      + self._options(cnf))
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									config = configure
							 | 
						
					
						
							
								
									
										
										
										
											1997-09-29 23:24:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def cget(self, key):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call(self._w, 'cget', '-' + key)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									__getitem__ = cget
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def __setitem__(self, key, value):
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.configure({key: value})
							 | 
						
					
						
							
								
									
										
										
										
											1997-09-29 23:24:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def keys(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return map(lambda x: x[0][1:],
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											   self.tk.split(self.tk.call(self._w, 'configure')))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def __str__(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._w
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									# Pack methods that apply to the master
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									_noarg_ = ['_noarg_']
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def pack_propagate(self, flag=_noarg_):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if flag is Misc._noarg_:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return self._getboolean(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												'pack', 'propagate', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										else:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('pack', 'propagate', self._w, flag)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									propagate = pack_propagate
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def pack_slaves(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return map(self._nametowidget,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											   self.tk.splitlist(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												   self.tk.call('pack', 'slaves', self._w)))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									slaves = pack_slaves
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									# Place method that applies to the master
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def place_slaves(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return map(self._nametowidget,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											   self.tk.splitlist(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												   self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													   'place', 'slaves', self._w)))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									# Grid methods that apply to the master
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def grid_bbox(self, column, row):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._getints(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												'grid', 'bbox', self._w, column, row)) or None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bbox = grid_bbox
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fixed several bugs reported by Greg McFarmane:
 *  The invoke methods of the three Tkinter widgets Button,
    Checkbutton and Radiobutton should return the value returned by
    the callback, (like the Menu widget does):
	def invoke(self):
	    return self.tk.call(self._w, 'invoke')
 *  The select_from method of the Canvas widget should use 'from', not
    'set':
	def select_from(self, tagOrId, index):
	    self.tk.call(self._w, 'select', 'from', tagOrId, index)
    Currently, if you use select_from, you get the error message:
 'TclError: bad select option "set": must be adjust, clear, from, item, or to'
 *  The 'entrycget' and 'type' methods of the Tk menu widget are
    missing from Tkinter.
 *  There is a bug in grid_columnconfigure and grid_rowconfigure.  For
    example, this should return the current value of the 'minsize'
    option for column 0:
	f.grid_columnconfigure(0, 'minsize')
    Instead it returns the same as:
	f.grid_columnconfigure(0)
    I suggest that the hint given in the comment in the
    Tkinter.Misc.configure method should be followed - "ought to
    generalize this so tag_config etc.  can use it".  Repeating the
    same configure code several times in Tkinter is inviting errors.
    [I did not follow this advice --G]
 *  The grid_slaves method should handle options.  Currently, to pass
    options to the grid_slaves method, you have to do something like:
	grid_slaves('-row', 1)
											
										 
										
											1997-12-29 19:59:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def _grid_configure(self, command, index, cnf, kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if type(cnf) is StringType and not kw:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											if cnf[-1:] == '_':
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												cnf = cnf[:-1]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											if cnf[:1] != '-':
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												cnf = '-'+cnf
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											options = (cnf,)
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										else:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											options = self._options(cnf, kw)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if not options:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											res = self.tk.call('grid',
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fixed several bugs reported by Greg McFarmane:
 *  The invoke methods of the three Tkinter widgets Button,
    Checkbutton and Radiobutton should return the value returned by
    the callback, (like the Menu widget does):
	def invoke(self):
	    return self.tk.call(self._w, 'invoke')
 *  The select_from method of the Canvas widget should use 'from', not
    'set':
	def select_from(self, tagOrId, index):
	    self.tk.call(self._w, 'select', 'from', tagOrId, index)
    Currently, if you use select_from, you get the error message:
 'TclError: bad select option "set": must be adjust, clear, from, item, or to'
 *  The 'entrycget' and 'type' methods of the Tk menu widget are
    missing from Tkinter.
 *  There is a bug in grid_columnconfigure and grid_rowconfigure.  For
    example, this should return the current value of the 'minsize'
    option for column 0:
	f.grid_columnconfigure(0, 'minsize')
    Instead it returns the same as:
	f.grid_columnconfigure(0)
    I suggest that the hint given in the comment in the
    Tkinter.Misc.configure method should be followed - "ought to
    generalize this so tag_config etc.  can use it".  Repeating the
    same configure code several times in Tkinter is inviting errors.
    [I did not follow this advice --G]
 *  The grid_slaves method should handle options.  Currently, to pass
    options to the grid_slaves method, you have to do something like:
	grid_slaves('-row', 1)
											
										 
										
											1997-12-29 19:59:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
													   command, self._w, index)
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											words = self.tk.splitlist(res)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											dict = {}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											for i in range(0, len(words), 2):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												key = words[i][1:]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												value = words[i+1]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												if not value:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													value = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												elif '.' in value:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													value = self.tk.getdouble(value)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												else:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													value = self.tk.getint(value)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												dict[key] = value
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return dict
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										res = apply(self.tk.call, 
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fixed several bugs reported by Greg McFarmane:
 *  The invoke methods of the three Tkinter widgets Button,
    Checkbutton and Radiobutton should return the value returned by
    the callback, (like the Menu widget does):
	def invoke(self):
	    return self.tk.call(self._w, 'invoke')
 *  The select_from method of the Canvas widget should use 'from', not
    'set':
	def select_from(self, tagOrId, index):
	    self.tk.call(self._w, 'select', 'from', tagOrId, index)
    Currently, if you use select_from, you get the error message:
 'TclError: bad select option "set": must be adjust, clear, from, item, or to'
 *  The 'entrycget' and 'type' methods of the Tk menu widget are
    missing from Tkinter.
 *  There is a bug in grid_columnconfigure and grid_rowconfigure.  For
    example, this should return the current value of the 'minsize'
    option for column 0:
	f.grid_columnconfigure(0, 'minsize')
    Instead it returns the same as:
	f.grid_columnconfigure(0)
    I suggest that the hint given in the comment in the
    Tkinter.Misc.configure method should be followed - "ought to
    generalize this so tag_config etc.  can use it".  Repeating the
    same configure code several times in Tkinter is inviting errors.
    [I did not follow this advice --G]
 *  The grid_slaves method should handle options.  Currently, to pass
    options to the grid_slaves method, you have to do something like:
	grid_slaves('-row', 1)
											
										 
										
											1997-12-29 19:59:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											      ('grid', command, self._w, index) 
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											      + options)
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fixed several bugs reported by Greg McFarmane:
 *  The invoke methods of the three Tkinter widgets Button,
    Checkbutton and Radiobutton should return the value returned by
    the callback, (like the Menu widget does):
	def invoke(self):
	    return self.tk.call(self._w, 'invoke')
 *  The select_from method of the Canvas widget should use 'from', not
    'set':
	def select_from(self, tagOrId, index):
	    self.tk.call(self._w, 'select', 'from', tagOrId, index)
    Currently, if you use select_from, you get the error message:
 'TclError: bad select option "set": must be adjust, clear, from, item, or to'
 *  The 'entrycget' and 'type' methods of the Tk menu widget are
    missing from Tkinter.
 *  There is a bug in grid_columnconfigure and grid_rowconfigure.  For
    example, this should return the current value of the 'minsize'
    option for column 0:
	f.grid_columnconfigure(0, 'minsize')
    Instead it returns the same as:
	f.grid_columnconfigure(0)
    I suggest that the hint given in the comment in the
    Tkinter.Misc.configure method should be followed - "ought to
    generalize this so tag_config etc.  can use it".  Repeating the
    same configure code several times in Tkinter is inviting errors.
    [I did not follow this advice --G]
 *  The grid_slaves method should handle options.  Currently, to pass
    options to the grid_slaves method, you have to do something like:
	grid_slaves('-row', 1)
											
										 
										
											1997-12-29 19:59:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if len(options) == 1:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											if not res: return None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											# In Tk 7.5, -width can be a float
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											if '.' in res: return self.tk.getdouble(res)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return self.tk.getint(res)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def grid_columnconfigure(self, index, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._grid_configure('columnconfigure', index, cnf, kw)
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									columnconfigure = grid_columnconfigure
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def grid_propagate(self, flag=_noarg_):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if flag is Misc._noarg_:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return self._getboolean(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												'grid', 'propagate', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										else:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('grid', 'propagate', self._w, flag)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def grid_rowconfigure(self, index, cnf={}, **kw):
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fixed several bugs reported by Greg McFarmane:
 *  The invoke methods of the three Tkinter widgets Button,
    Checkbutton and Radiobutton should return the value returned by
    the callback, (like the Menu widget does):
	def invoke(self):
	    return self.tk.call(self._w, 'invoke')
 *  The select_from method of the Canvas widget should use 'from', not
    'set':
	def select_from(self, tagOrId, index):
	    self.tk.call(self._w, 'select', 'from', tagOrId, index)
    Currently, if you use select_from, you get the error message:
 'TclError: bad select option "set": must be adjust, clear, from, item, or to'
 *  The 'entrycget' and 'type' methods of the Tk menu widget are
    missing from Tkinter.
 *  There is a bug in grid_columnconfigure and grid_rowconfigure.  For
    example, this should return the current value of the 'minsize'
    option for column 0:
	f.grid_columnconfigure(0, 'minsize')
    Instead it returns the same as:
	f.grid_columnconfigure(0)
    I suggest that the hint given in the comment in the
    Tkinter.Misc.configure method should be followed - "ought to
    generalize this so tag_config etc.  can use it".  Repeating the
    same configure code several times in Tkinter is inviting errors.
    [I did not follow this advice --G]
 *  The grid_slaves method should handle options.  Currently, to pass
    options to the grid_slaves method, you have to do something like:
	grid_slaves('-row', 1)
											
										 
										
											1997-12-29 19:59:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self._grid_configure('rowconfigure', index, cnf, kw)
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									rowconfigure = grid_rowconfigure
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def grid_size(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._getints(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('grid', 'size', self._w)) or None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									size = grid_size
							 | 
						
					
						
							
								
									
										
										
										
											1997-12-30 04:07:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def grid_slaves(self, row=None, column=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										args = ()
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fixed several bugs reported by Greg McFarmane:
 *  The invoke methods of the three Tkinter widgets Button,
    Checkbutton and Radiobutton should return the value returned by
    the callback, (like the Menu widget does):
	def invoke(self):
	    return self.tk.call(self._w, 'invoke')
 *  The select_from method of the Canvas widget should use 'from', not
    'set':
	def select_from(self, tagOrId, index):
	    self.tk.call(self._w, 'select', 'from', tagOrId, index)
    Currently, if you use select_from, you get the error message:
 'TclError: bad select option "set": must be adjust, clear, from, item, or to'
 *  The 'entrycget' and 'type' methods of the Tk menu widget are
    missing from Tkinter.
 *  There is a bug in grid_columnconfigure and grid_rowconfigure.  For
    example, this should return the current value of the 'minsize'
    option for column 0:
	f.grid_columnconfigure(0, 'minsize')
    Instead it returns the same as:
	f.grid_columnconfigure(0)
    I suggest that the hint given in the comment in the
    Tkinter.Misc.configure method should be followed - "ought to
    generalize this so tag_config etc.  can use it".  Repeating the
    same configure code several times in Tkinter is inviting errors.
    [I did not follow this advice --G]
 *  The grid_slaves method should handle options.  Currently, to pass
    options to the grid_slaves method, you have to do something like:
	grid_slaves('-row', 1)
											
										 
										
											1997-12-29 19:59:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if row:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											args = args + ('-row', row)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if column:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											args = args + ('-column', column)
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return map(self._nametowidget,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											   self.tk.splitlist(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												   apply(self.tk.call,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													 ('grid', 'slaves', self._w) + args)))
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1997-12-02 19:51:39 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									# Support for the "event" command, new in Tk 4.2.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									# By Case Roole.
							 | 
						
					
						
							
								
									
										
										
										
											1998-03-20 20:45:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									# XXX Why is this using the default root?
							 | 
						
					
						
							
								
									
										
										
										
											1997-12-02 19:51:39 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def event_add(self,virtual, *sequences):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										args = ('event', 'add', virtual) + sequences
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply( _default_root.tk.call, args )
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def event_delete(self,virtual,*sequences):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										args = ('event', 'delete', virtual) + sequences
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply( _default_root.tk.call, args )
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def event_generate(self, sequence, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										args = ('event', 'generate', self._w, sequence)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										for k,v in kw.items():
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											args = args + ('-%s' % k,str(v))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply( _default_root.tk.call, args )
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def event_info(self,virtual=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										args = ('event', 'info')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if virtual is not None: args = args + (virtual,)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										s = apply( _default_root.tk.call, args )
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return _string.split(s)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1995-09-07 19:22:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								class CallWrapper:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def __init__(self, func, subst, widget):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.func = func
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.subst = subst
							 | 
						
					
						
							
								
									
										
										
										
											1995-09-07 19:22:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.widget = widget
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def __call__(self, *args):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										try:
							 | 
						
					
						
							
								
									
										
										
										
											1995-09-07 19:22:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											if self.subst:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												args = apply(self.subst, args)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return apply(self.func, args)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 12:19:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										except SystemExit, msg:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											raise SystemExit, msg
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										except:
							 | 
						
					
						
							
								
									
										
										
										
											1995-09-07 19:22:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											self.widget._report_exception()
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Wm:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def aspect(self, 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										   minNumer=None, minDenom=None, 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										   maxNumer=None, maxDenom=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._getints(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('wm', 'aspect', self._w, 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												     minNumer, minDenom, 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												     maxNumer, maxDenom))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def client(self, name=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('wm', 'client', self._w, name)
							 | 
						
					
						
							
								
									
										
										
										
											1996-09-27 14:06:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def colormapwindows(self, *wlist):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										args = ('wm', 'colormapwindows', self._w) + _flatten(wlist)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return map(self._nametowidget, apply(self.tk.call, args))
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def command(self, value=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('wm', 'command', self._w, value)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def deiconify(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('wm', 'deiconify', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def focusmodel(self, model=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('wm', 'focusmodel', self._w, model)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def frame(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('wm', 'frame', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def geometry(self, newGeometry=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('wm', 'geometry', self._w, newGeometry)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def grid(self,
							 | 
						
					
						
							
								
									
										
										
										
											1998-02-24 23:26:18 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										 baseWidth=None, baseHeight=None, 
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										 widthInc=None, heightInc=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._getints(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											'wm', 'grid', self._w,
							 | 
						
					
						
							
								
									
										
										
										
											1997-12-27 15:14:43 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											baseWidth, baseHeight, widthInc, heightInc))
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def group(self, pathName=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('wm', 'group', self._w, pathName)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def iconbitmap(self, bitmap=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def iconify(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('wm', 'iconify', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def iconmask(self, bitmap=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('wm', 'iconmask', self._w, bitmap)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def iconname(self, newName=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('wm', 'iconname', self._w, newName)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def iconposition(self, x=None, y=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._getints(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											'wm', 'iconposition', self._w, x, y))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def iconwindow(self, pathName=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('wm', 'iconwindow', self._w, pathName)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def maxsize(self, width=None, height=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._getints(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											'wm', 'maxsize', self._w, width, height))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def minsize(self, width=None, height=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._getints(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											'wm', 'minsize', self._w, width, height))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def overrideredirect(self, boolean=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._getboolean(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											'wm', 'overrideredirect', self._w, boolean))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def positionfrom(self, who=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('wm', 'positionfrom', self._w, who)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def protocol(self, name=None, func=None):
							 | 
						
					
						
							
								
									
										
										
										
											1998-03-20 20:45:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if callable(func):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											command = self._register(func)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										else:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											command = func
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											'wm', 'protocol', self._w, name, command)
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def resizable(self, width=None, height=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('wm', 'resizable', self._w, width, height)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def sizefrom(self, who=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('wm', 'sizefrom', self._w, who)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def state(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('wm', 'state', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def title(self, string=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('wm', 'title', self._w, string)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def transient(self, master=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('wm', 'transient', self._w, master)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def withdraw(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('wm', 'withdraw', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Tk(Misc, Wm):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									_w = '.'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def __init__(self, screenName=None, baseName=None, className='Tk'):
							 | 
						
					
						
							
								
									
										
										
										
											1995-09-07 19:22:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										global _default_root
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 12:19:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.master = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.children = {}
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if baseName is None:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											import sys, os
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											baseName = os.path.basename(sys.argv[0])
							 | 
						
					
						
							
								
									
										
										
										
											1996-10-06 17:55:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											baseName, ext = os.path.splitext(baseName)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											if ext not in ('.py', 'pyc'): baseName = baseName + ext
							 | 
						
					
						
							
								
									
										
										
										
											1997-02-15 18:33:24 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.tk = _tkinter.create(screenName, baseName, className)
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										try:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											# Disable event scanning except for Command-Period
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											import MacOS
							 | 
						
					
						
							
								
									
										
										
										
											1997-08-12 18:21:08 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											try:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												MacOS.SchedParams(1, 0)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											except AttributeError:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												# pre-1.5, use old routine
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												MacOS.EnableAppswitch(0)
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										except ImportError:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											pass
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										else:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											# Work around nasty MacTk bug
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.update()
							 | 
						
					
						
							
								
									
										
										
										
											1995-10-07 19:08:37 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										# Version sanity checks
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										tk_version = self.tk.getvar('tk_version')
							 | 
						
					
						
							
								
									
										
										
										
											1997-02-15 18:33:24 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if tk_version != _tkinter.TK_VERSION:
							 | 
						
					
						
							
								
									
										
										
										
											1995-10-07 19:08:37 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										    raise RuntimeError, \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										    "tk.h version (%s) doesn't match libtk.a version (%s)" \
							 | 
						
					
						
							
								
									
										
										
										
											1997-02-15 18:33:24 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										    % (_tkinter.TK_VERSION, tk_version)
							 | 
						
					
						
							
								
									
										
										
										
											1995-10-07 19:08:37 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										tcl_version = self.tk.getvar('tcl_version')
							 | 
						
					
						
							
								
									
										
										
										
											1997-02-15 18:33:24 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if tcl_version != _tkinter.TCL_VERSION:
							 | 
						
					
						
							
								
									
										
										
										
											1995-10-07 19:08:37 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										    raise RuntimeError, \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										    "tcl.h version (%s) doesn't match libtcl.a version (%s)" \
							 | 
						
					
						
							
								
									
										
										
										
											1997-02-15 18:33:24 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										    % (_tkinter.TCL_VERSION, tcl_version)
							 | 
						
					
						
							
								
									
										
										
										
											1995-10-07 19:08:37 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if TkVersion < 4.0:
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											raise RuntimeError, \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											"Tk 4.0 or higher is required; found Tk %s" \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											% str(TkVersion)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 12:19:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.tk.createcommand('tkerror', _tkerror)
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-07 13:12:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.tk.createcommand('exit', _exit)
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-12 15:52:32 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.readprofile(baseName, className)
							 | 
						
					
						
							
								
									
										
										
										
											1998-03-20 20:45:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if _support_default_root and not _default_root:
							 | 
						
					
						
							
								
									
										
										
										
											1995-09-07 19:22:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											_default_root = self
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 12:19:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def destroy(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										for c in self.children.values(): c.destroy()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('destroy', self._w)
							 | 
						
					
						
							
								
									
										
										
										
											1997-04-14 13:30:24 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										Misc.destroy(self)
							 | 
						
					
						
							
								
									
										
										
										
											1997-08-05 02:35:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										global _default_root
							 | 
						
					
						
							
								
									
										
										
										
											1998-03-20 20:45:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if _support_default_root and _default_root is self:
							 | 
						
					
						
							
								
									
										
										
										
											1997-08-05 02:35:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											_default_root = None
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-12 15:52:32 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def readprofile(self, baseName, className):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										import os
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-12 15:52:32 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if os.environ.has_key('HOME'): home = os.environ['HOME']
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										else: home = os.curdir
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										class_tcl = os.path.join(home, '.%s.tcl' % className)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										class_py = os.path.join(home, '.%s.py' % className)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										base_tcl = os.path.join(home, '.%s.tcl' % baseName)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										base_py = os.path.join(home, '.%s.py' % baseName)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										dir = {'self': self}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										exec 'from Tkinter import *' in dir
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if os.path.isfile(class_tcl):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											print 'source', `class_tcl`
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('source', class_tcl)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if os.path.isfile(class_py):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											print 'execfile', `class_py`
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											execfile(class_py, dir)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if os.path.isfile(base_tcl):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											print 'source', `base_tcl`
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('source', base_tcl)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if os.path.isfile(base_py):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											print 'execfile', `base_py`
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											execfile(base_py, dir)
							 | 
						
					
						
							
								
									
										
										
										
											1995-09-07 19:22:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def report_callback_exception(self, exc, val, tb):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										import traceback
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										print "Exception in Tkinter callback"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										traceback.print_exception(exc, val, tb)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# Ideally, the classes Pack, Place and Grid disappear, the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# pack/place/grid methods are defined on the Widget class, and
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# everybody uses w.pack_whatever(...) instead of Pack.whatever(w,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# ...), with pack(), place() and grid() being short for
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# pack_configure(), place_configure() and grid_columnconfigure(), and
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# forget() being short for pack_forget().  As a practical matter, I'm
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# afraid that there is too much code out there that may be using the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Pack, Place or Grid class, so I leave them intact -- but only as
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# backwards compatibility features.  Also note that those methods that
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# take a master as argument (e.g. pack_propagate) have been moved to
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# the Misc class (which now incorporates all methods common between
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# toplevel and interior widgets).  Again, for compatibility, these are
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# copied into the Pack, Place or Grid class.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Pack:
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def pack_configure(self, cnf={}, **kw):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										      ('pack', 'configure', self._w) 
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										      + self._options(cnf, kw))
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									pack = configure = config = pack_configure
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def pack_forget(self):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('pack', 'forget', self._w)
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									forget = pack_forget
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def pack_info(self):
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-11 15:21:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										words = self.tk.splitlist(
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											self.tk.call('pack', 'info', self._w))
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-11 15:21:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										dict = {}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										for i in range(0, len(words), 2):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											key = words[i][1:]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											value = words[i+1]
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 17:50:07 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											if value[:1] == '.':
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-11 15:21:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
												value = self._nametowidget(value)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											dict[key] = value
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return dict
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									info = pack_info
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									propagate = pack_propagate = Misc.pack_propagate
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									slaves = pack_slaves = Misc.pack_slaves
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Place:
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def place_configure(self, cnf={}, **kw):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										for k in ['in_']:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											if kw.has_key(k):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												kw[k[:-1]] = kw[k]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												del kw[k]
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										      ('place', 'configure', self._w) 
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										      + self._options(cnf, kw))
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									place = configure = config = place_configure
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def place_forget(self):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('place', 'forget', self._w)
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									forget = place_forget
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def place_info(self):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 17:53:48 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										words = self.tk.splitlist(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('place', 'info', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										dict = {}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										for i in range(0, len(words), 2):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											key = words[i][1:]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											value = words[i+1]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											if value[:1] == '.':
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												value = self._nametowidget(value)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											dict[key] = value
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return dict
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									info = place_info
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									slaves = place_slaves = Misc.place_slaves
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								class Grid:
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-21 20:30:07 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									# Thanks to Masazumi Yoshikawa (yosikawa@isi.edu)
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def grid_configure(self, cnf={}, **kw):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										      ('grid', 'configure', self._w) 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										      + self._options(cnf, kw))
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									grid = configure = config = grid_configure
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bbox = grid_bbox = Misc.grid_bbox
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									columnconfigure = grid_columnconfigure = Misc.grid_columnconfigure
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def grid_forget(self):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.tk.call('grid', 'forget', self._w)
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									forget = grid_forget
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def grid_info(self):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										words = self.tk.splitlist(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('grid', 'info', self._w))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										dict = {}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										for i in range(0, len(words), 2):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											key = words[i][1:]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											value = words[i+1]
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 17:50:07 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											if value[:1] == '.':
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
												value = self._nametowidget(value)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											dict[key] = value
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return dict
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									info = grid_info
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def grid_location(self, x, y):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self._getints(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												'grid', 'location', self._w, x, y)) or None
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									location = grid_location
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									propagate = grid_propagate = Misc.grid_propagate
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									rowconfigure = grid_rowconfigure = Misc.grid_rowconfigure
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									size = grid_size = Misc.grid_size
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									slaves = grid_slaves = Misc.grid_slaves
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								class BaseWidget(Misc):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def _setup(self, master, cnf):
							 | 
						
					
						
							
								
									
										
										
										
											1998-03-20 20:45:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if _support_default_root:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											global _default_root
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											if not master:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												if not _default_root:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													_default_root = Tk()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												master = _default_root
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 12:19:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											if not _default_root:
							 | 
						
					
						
							
								
									
										
										
										
											1998-03-20 20:45:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
												_default_root = master
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.master = master
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk = master.tk
							 | 
						
					
						
							
								
									
										
										
										
											1997-05-27 22:45:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										name = None
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if cnf.has_key('name'):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											name = cnf['name']
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											del cnf['name']
							 | 
						
					
						
							
								
									
										
										
										
											1997-05-27 22:45:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if not name:
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											name = `id(self)`
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 12:19:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self._name = name
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if master._w=='.':
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self._w = '.' + name
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										else:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self._w = master._w + '.' + name
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.children = {}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if self.master.children.has_key(self._name):
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-06 09:23:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											self.master.children[self._name].destroy()
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.master.children[self._name] = self
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, master, widgetName, cnf={}, kw={}, extra=()):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if kw:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											cnf = _cnfmerge((cnf, kw))
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.widgetName = widgetName
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										BaseWidget._setup(self, master, cnf)
							 | 
						
					
						
							
								
									
										
										
										
											1996-07-21 03:05:05 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										classes = []
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										for k in cnf.keys():
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											if type(k) is ClassType:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												classes.append((k, cnf[k]))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												del cnf[k]
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										      (widgetName, self._w) + extra + self._options(cnf))
							 | 
						
					
						
							
								
									
										
										
										
											1996-07-21 03:05:05 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										for k, v in classes:
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											k.configure(self, v)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 12:19:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def destroy(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										for c in self.children.values(): c.destroy()
							 | 
						
					
						
							
								
									
										
										
										
											1994-08-30 12:13:44 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if self.master.children.has_key(self._name):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											del self.master.children[self._name]
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('destroy', self._w)
							 | 
						
					
						
							
								
									
										
										
										
											1997-04-14 13:30:24 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										Misc.destroy(self)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def _do(self, name, args=()):
							 | 
						
					
						
							
								
									
										
										
										
											1995-07-14 15:29:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return apply(self.tk.call, (self._w, name) + args)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								class Widget(BaseWidget, Pack, Place, Grid):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									pass
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Toplevel(BaseWidget, Wm):
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, master=None, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if kw:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											cnf = _cnfmerge((cnf, kw))
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										extra = ()
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										for wmkey in ['screen', 'class_', 'class', 'visual',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											      'colormap']:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											if cnf.has_key(wmkey):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												val = cnf[wmkey]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												# TBD: a hack needed because some keys
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												# are not valid as keyword arguments
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												if wmkey[-1] == '_': opt = '-'+wmkey[:-1]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												else: opt = '-'+wmkey
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												extra = extra + (opt, val)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												del cnf[wmkey]
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										BaseWidget.__init__(self, master, 'toplevel', cnf, {}, extra)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 12:19:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										root = self._root()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.iconname(root.iconname())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.title(root.title())
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Button(Widget):
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, master=None, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Widget.__init__(self, master, 'button', cnf, kw)
							 | 
						
					
						
							
								
									
										
										
										
											1995-07-14 15:29:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def tkButtonEnter(self, *dummy):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('tkButtonEnter', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tkButtonLeave(self, *dummy):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('tkButtonLeave', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tkButtonDown(self, *dummy):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('tkButtonDown', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tkButtonUp(self, *dummy):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('tkButtonUp', self._w)
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 17:11:27 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def tkButtonInvoke(self, *dummy):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('tkButtonInvoke', self._w)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def flash(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'flash')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def invoke(self):
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fixed several bugs reported by Greg McFarmane:
 *  The invoke methods of the three Tkinter widgets Button,
    Checkbutton and Radiobutton should return the value returned by
    the callback, (like the Menu widget does):
	def invoke(self):
	    return self.tk.call(self._w, 'invoke')
 *  The select_from method of the Canvas widget should use 'from', not
    'set':
	def select_from(self, tagOrId, index):
	    self.tk.call(self._w, 'select', 'from', tagOrId, index)
    Currently, if you use select_from, you get the error message:
 'TclError: bad select option "set": must be adjust, clear, from, item, or to'
 *  The 'entrycget' and 'type' methods of the Tk menu widget are
    missing from Tkinter.
 *  There is a bug in grid_columnconfigure and grid_rowconfigure.  For
    example, this should return the current value of the 'minsize'
    option for column 0:
	f.grid_columnconfigure(0, 'minsize')
    Instead it returns the same as:
	f.grid_columnconfigure(0)
    I suggest that the hint given in the comment in the
    Tkinter.Misc.configure method should be followed - "ought to
    generalize this so tag_config etc.  can use it".  Repeating the
    same configure code several times in Tkinter is inviting errors.
    [I did not follow this advice --G]
 *  The grid_slaves method should handle options.  Currently, to pass
    options to the grid_slaves method, you have to do something like:
	grid_slaves('-row', 1)
											
										 
										
											1997-12-29 19:59:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self.tk.call(self._w, 'invoke')
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Indices:
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# XXX I don't like these -- take them away
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								def AtEnd():
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									return 'end'
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 09:09:51 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								def AtInsert(*args):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									s = 'insert'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									for a in args:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if a: s = s + (' ' + a)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									return s
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								def AtSelFirst():
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									return 'sel.first'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								def AtSelLast():
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									return 'sel.last'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								def At(x, y=None):
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-12 09:04:41 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									if y is None:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return '@' + `x`		
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									else:
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-12 09:04:41 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return '@' + `x` + ',' + `y`
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Canvas(Widget):
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, master=None, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Widget.__init__(self, master, 'canvas', cnf, kw)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def addtag(self, *args):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self._do('addtag', args)
							 | 
						
					
						
							
								
									
										
										
										
											1996-08-22 23:18:09 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def addtag_above(self, newtag, tagOrId):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.addtag(newtag, 'above', tagOrId)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def addtag_all(self, newtag):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.addtag(newtag, 'all')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def addtag_below(self, newtag, tagOrId):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.addtag(newtag, 'below', tagOrId)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def addtag_closest(self, newtag, x, y, halo=None, start=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.addtag(newtag, 'closest', x, y, halo, start)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def addtag_enclosed(self, newtag, x1, y1, x2, y2):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.addtag(newtag, 'enclosed', x1, y1, x2, y2)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def addtag_overlapping(self, newtag, x1, y1, x2, y2):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.addtag(newtag, 'overlapping', x1, y1, x2, y2)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def addtag_withtag(self, newtag, tagOrId):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.addtag(newtag, 'withtag', tagOrId)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def bbox(self, *args):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-23 07:40:14 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self._getints(self._do('bbox', args)) or None
							 | 
						
					
						
							
								
									
										
										
										
											1998-03-27 21:26:51 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def tag_unbind(self, tagOrId, sequence, funcid=None):
							 | 
						
					
						
							
								
									
										
										
										
											1994-08-08 12:47:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'bind', tagOrId, sequence, '')
							 | 
						
					
						
							
								
									
										
										
										
											1998-03-27 21:26:51 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if funcid:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.deletecommand(funcid)
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def tag_bind(self, tagOrId, sequence=None, func=None, add=None):
							 | 
						
					
						
							
								
									
										
										
										
											1996-07-21 02:19:32 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self._bind((self._w, 'bind', tagOrId),
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
												  sequence, func, add)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def canvasx(self, screenx, gridspacing=None):
							 | 
						
					
						
							
								
									
										
										
										
											1995-07-14 15:29:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self.tk.getdouble(self.tk.call(
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self._w, 'canvasx', screenx, gridspacing))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def canvasy(self, screeny, gridspacing=None):
							 | 
						
					
						
							
								
									
										
										
										
											1995-07-14 15:29:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self.tk.getdouble(self.tk.call(
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self._w, 'canvasy', screeny, gridspacing))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def coords(self, *args):
							 | 
						
					
						
							
								
									
										
										
										
											1998-02-19 21:20:30 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										# XXX Should use _flatten on args
							 | 
						
					
						
							
								
									
										
										
										
											1996-07-30 16:31:32 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return map(self.tk.getdouble,
							 | 
						
					
						
							
								
									
										
										
										
											1996-07-30 20:16:21 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                           self.tk.splitlist(self._do('coords', args)))
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def _create(self, itemType, args, kw): # Args: (val, val, ..., cnf={})
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-21 11:44:21 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										args = _flatten(args)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										cnf = args[-1]
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-06 09:23:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if type(cnf) in (DictionaryType, TupleType):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											args = args[:-1]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										else:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											cnf = {}
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-06 09:23:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(apply(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											(self._w, 'create', itemType) 
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											+ args + self._options(cnf, kw)))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def create_arc(self, *args, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._create('arc', args, kw)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def create_bitmap(self, *args, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._create('bitmap', args, kw)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def create_image(self, *args, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._create('image', args, kw)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def create_line(self, *args, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._create('line', args, kw)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def create_oval(self, *args, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._create('oval', args, kw)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def create_polygon(self, *args, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._create('polygon', args, kw)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def create_rectangle(self, *args, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._create('rectangle', args, kw)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def create_text(self, *args, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._create('text', args, kw)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def create_window(self, *args, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._create('window', args, kw)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def dchars(self, *args):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self._do('dchars', args)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def delete(self, *args):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self._do('delete', args)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def dtag(self, *args):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self._do('dtag', args)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def find(self, *args):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self._getints(self._do('find', args)) or ()
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-23 07:40:14 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def find_above(self, tagOrId):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.find('above', tagOrId)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def find_all(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.find('all')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def find_below(self, tagOrId):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.find('below', tagOrId)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def find_closest(self, x, y, halo=None, start=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.find('closest', x, y, halo, start)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def find_enclosed(self, x1, y1, x2, y2):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.find('enclosed', x1, y1, x2, y2)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def find_overlapping(self, x1, y1, x2, y2):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.find('overlapping', x1, y1, x2, y2)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def find_withtag(self, tagOrId):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.find('withtag', tagOrId)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def focus(self, *args):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._do('focus', args)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def gettags(self, *args):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.splitlist(self._do('gettags', args))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def icursor(self, *args):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self._do('icursor', args)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def index(self, *args):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(self._do('index', args))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def insert(self, *args):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self._do('insert', args)
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def itemcget(self, tagOrId, option):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._do('itemcget', (tagOrId, '-'+option))
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def itemconfigure(self, tagOrId, cnf=None, **kw):
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if cnf is None and not kw:
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-23 07:40:14 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											cnf = {}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											for x in self.tk.split(
							 | 
						
					
						
							
								
									
										
										
										
											1997-08-18 14:44:04 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
												self._do('itemconfigure', (tagOrId,))):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-23 07:40:14 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
												cnf[x[0][1:]] = (x[0][1:],) + x[1:]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return cnf
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if type(cnf) == StringType and not kw:
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-23 07:40:14 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											x = self.tk.split(self._do('itemconfigure',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
														   (tagOrId, '-'+cnf,)))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return (x[0][1:],) + x[1:]
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self._do('itemconfigure', (tagOrId,)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											 + self._options(cnf, kw))
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									itemconfig = itemconfigure
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def lower(self, *args):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self._do('lower', args)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def move(self, *args):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self._do('move', args)
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def postscript(self, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._do('postscript', self._options(cnf, kw))
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tkraise(self, *args):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self._do('raise', args)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 08:12:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									lift = tkraise
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def scale(self, *args):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self._do('scale', args)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def scan_mark(self, x, y):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'scan', 'mark', x, y)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def scan_dragto(self, x, y):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'scan', 'dragto', x, y)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def select_adjust(self, tagOrId, index):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-21 11:44:21 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'select', 'adjust', tagOrId, index)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def select_clear(self):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'select', 'clear')
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def select_from(self, tagOrId, index):
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fixed several bugs reported by Greg McFarmane:
 *  The invoke methods of the three Tkinter widgets Button,
    Checkbutton and Radiobutton should return the value returned by
    the callback, (like the Menu widget does):
	def invoke(self):
	    return self.tk.call(self._w, 'invoke')
 *  The select_from method of the Canvas widget should use 'from', not
    'set':
	def select_from(self, tagOrId, index):
	    self.tk.call(self._w, 'select', 'from', tagOrId, index)
    Currently, if you use select_from, you get the error message:
 'TclError: bad select option "set": must be adjust, clear, from, item, or to'
 *  The 'entrycget' and 'type' methods of the Tk menu widget are
    missing from Tkinter.
 *  There is a bug in grid_columnconfigure and grid_rowconfigure.  For
    example, this should return the current value of the 'minsize'
    option for column 0:
	f.grid_columnconfigure(0, 'minsize')
    Instead it returns the same as:
	f.grid_columnconfigure(0)
    I suggest that the hint given in the comment in the
    Tkinter.Misc.configure method should be followed - "ought to
    generalize this so tag_config etc.  can use it".  Repeating the
    same configure code several times in Tkinter is inviting errors.
    [I did not follow this advice --G]
 *  The grid_slaves method should handle options.  Currently, to pass
    options to the grid_slaves method, you have to do something like:
	grid_slaves('-row', 1)
											
										 
										
											1997-12-29 19:59:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'select', 'from', tagOrId, index)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def select_item(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'select', 'item')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def select_to(self, tagOrId, index):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-21 11:44:21 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'select', 'to', tagOrId, index)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def type(self, tagOrId):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-21 11:44:21 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self.tk.call(self._w, 'type', tagOrId) or None
							 | 
						
					
						
							
								
									
										
										
										
											1995-07-14 15:29:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def xview(self, *args):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if not args:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return self._getdoubles(self.tk.call(self._w, 'xview'))
							 | 
						
					
						
							
								
									
										
										
										
											1995-07-14 15:29:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, (self._w, 'xview')+args)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def yview(self, *args):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if not args:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return self._getdoubles(self.tk.call(self._w, 'yview'))
							 | 
						
					
						
							
								
									
										
										
										
											1995-07-14 15:29:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, (self._w, 'yview')+args)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Checkbutton(Widget):
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, master=None, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Widget.__init__(self, master, 'checkbutton', cnf, kw)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def deselect(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'deselect')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def flash(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'flash')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def invoke(self):
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fixed several bugs reported by Greg McFarmane:
 *  The invoke methods of the three Tkinter widgets Button,
    Checkbutton and Radiobutton should return the value returned by
    the callback, (like the Menu widget does):
	def invoke(self):
	    return self.tk.call(self._w, 'invoke')
 *  The select_from method of the Canvas widget should use 'from', not
    'set':
	def select_from(self, tagOrId, index):
	    self.tk.call(self._w, 'select', 'from', tagOrId, index)
    Currently, if you use select_from, you get the error message:
 'TclError: bad select option "set": must be adjust, clear, from, item, or to'
 *  The 'entrycget' and 'type' methods of the Tk menu widget are
    missing from Tkinter.
 *  There is a bug in grid_columnconfigure and grid_rowconfigure.  For
    example, this should return the current value of the 'minsize'
    option for column 0:
	f.grid_columnconfigure(0, 'minsize')
    Instead it returns the same as:
	f.grid_columnconfigure(0)
    I suggest that the hint given in the comment in the
    Tkinter.Misc.configure method should be followed - "ought to
    generalize this so tag_config etc.  can use it".  Repeating the
    same configure code several times in Tkinter is inviting errors.
    [I did not follow this advice --G]
 *  The grid_slaves method should handle options.  Currently, to pass
    options to the grid_slaves method, you have to do something like:
	grid_slaves('-row', 1)
											
										 
										
											1997-12-29 19:59:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self.tk.call(self._w, 'invoke')
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def select(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'select')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def toggle(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'toggle')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Entry(Widget):
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, master=None, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Widget.__init__(self, master, 'entry', cnf, kw)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def delete(self, first, last=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'delete', first, last)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def get(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call(self._w, 'get')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def icursor(self, index):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'icursor', index)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def index(self, index):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self._w, 'index', index))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def insert(self, index, string):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'insert', index, string)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def scan_mark(self, x):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'scan', 'mark', x)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def scan_dragto(self, x):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'scan', 'dragto', x)
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-21 20:30:07 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def selection_adjust(self, index):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'selection', 'adjust', index)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									select_adjust = selection_adjust
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def selection_clear(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'selection', 'clear')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									select_clear = selection_clear
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def selection_from(self, index):
							 | 
						
					
						
							
								
									
										
										
										
											1996-09-06 14:20:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'selection', 'from', index)
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-21 20:30:07 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									select_from = selection_from
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def selection_present(self):
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-11 14:21:06 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self.tk.getboolean(
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-21 20:30:07 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											self.tk.call(self._w, 'selection', 'present'))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									select_present = selection_present
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def selection_range(self, start, end):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'selection', 'range', start, end)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									select_range = selection_range
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def selection_to(self, index):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'selection', 'to', index)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									select_to = selection_to
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def xview(self, index):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'xview', index)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def xview_moveto(self, fraction):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'xview', 'moveto', fraction)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def xview_scroll(self, number, what):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'xview', 'scroll', number, what)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Frame(Widget):
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, master=None, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										cnf = _cnfmerge((cnf, kw))
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										extra = ()
							 | 
						
					
						
							
								
									
										
										
										
											1997-01-10 15:13:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if cnf.has_key('class_'):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											extra = ('-class', cnf['class_'])
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											del cnf['class_']
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										elif cnf.has_key('class'):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
											extra = ('-class', cnf['class'])
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											del cnf['class']
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										Widget.__init__(self, master, 'frame', cnf, {}, extra)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Label(Widget):
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, master=None, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Widget.__init__(self, master, 'label', cnf, kw)
							 | 
						
					
						
							
								
									
										
										
										
											1995-07-14 15:29:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Listbox(Widget):
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, master=None, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Widget.__init__(self, master, 'listbox', cnf, kw)
							 | 
						
					
						
							
								
									
										
										
										
											1995-10-11 17:41:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def activate(self, index):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'activate', index)
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def bbox(self, *args):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._getints(self._do('bbox', args)) or None
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def curselection(self):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										# XXX Ought to apply self._getints()...
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.splitlist(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self._w, 'curselection'))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def delete(self, first, last=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'delete', first, last)
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def get(self, first, last=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if last:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return self.tk.splitlist(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												self._w, 'get', first, last))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										else:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return self.tk.call(self._w, 'get', first)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def insert(self, index, *elements):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										      (self._w, 'insert', index) + elements)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def nearest(self, y):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self._w, 'nearest', y))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def scan_mark(self, x, y):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'scan', 'mark', x, y)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def scan_dragto(self, x, y):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'scan', 'dragto', x, y)
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def see(self, index):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'see', index)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def index(self, index):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										i = self.tk.call(self._w, 'index', index)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if i == 'none': return None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(i)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def select_anchor(self, index):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'selection', 'anchor', index)
							 | 
						
					
						
							
								
									
										
										
										
											1997-02-14 16:21:16 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									selection_anchor = select_anchor
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def select_clear(self, first, last=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											     'selection', 'clear', first, last)
							 | 
						
					
						
							
								
									
										
										
										
											1997-02-14 16:21:16 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									selection_clear = select_clear
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def select_includes(self, index):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getboolean(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self._w, 'selection', 'includes', index))
							 | 
						
					
						
							
								
									
										
										
										
											1997-02-14 16:21:16 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									selection_includes = select_includes
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def select_set(self, first, last=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'selection', 'set', first, last)
							 | 
						
					
						
							
								
									
										
										
										
											1997-02-14 16:21:16 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									selection_set = select_set
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def size(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(self.tk.call(self._w, 'size'))
							 | 
						
					
						
							
								
									
										
										
										
											1995-07-14 15:29:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def xview(self, *what):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if not what:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return self._getdoubles(self.tk.call(self._w, 'xview'))
							 | 
						
					
						
							
								
									
										
										
										
											1995-07-14 15:29:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, (self._w, 'xview')+what)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def yview(self, *what):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if not what:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return self._getdoubles(self.tk.call(self._w, 'yview'))
							 | 
						
					
						
							
								
									
										
										
										
											1995-07-14 15:29:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, (self._w, 'yview')+what)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Menu(Widget):
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, master=None, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Widget.__init__(self, master, 'menu', cnf, kw)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tk_bindForTraversal(self):
							 | 
						
					
						
							
								
									
										
										
										
											1996-09-10 12:39:26 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										pass # obsolete since Tk 4.0
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tk_mbPost(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('tk_mbPost', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tk_mbUnpost(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('tk_mbUnpost')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tk_traverseToMenu(self, char):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('tk_traverseToMenu', self._w, char)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tk_traverseWithinMenu(self, char):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('tk_traverseWithinMenu', self._w, char)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tk_getMenuButtons(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('tk_getMenuButtons', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tk_nextMenu(self, count):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('tk_nextMenu', count)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tk_nextMenuEntry(self, count):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('tk_nextMenuEntry', count)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tk_invokeMenu(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('tk_invokeMenu', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tk_firstMenu(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('tk_firstMenu', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tk_mbButtonDown(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('tk_mbButtonDown', self._w)
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def tk_popup(self, x, y, entry=""):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('tk_popup', self._w, x, y, entry)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def activate(self, index):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'activate', index)
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def add(self, itemType, cnf={}, **kw):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, (self._w, 'add', itemType) 
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										      + self._options(cnf, kw))
							 | 
						
					
						
							
								
									
										
										
										
											1995-10-09 22:37:28 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def add_cascade(self, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.add('cascade', cnf or kw)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def add_checkbutton(self, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.add('checkbutton', cnf or kw)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def add_command(self, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.add('command', cnf or kw)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def add_radiobutton(self, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.add('radiobutton', cnf or kw)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def add_separator(self, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.add('separator', cnf or kw)
							 | 
						
					
						
							
								
									
										
										
										
											1996-09-05 16:46:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def insert(self, index, itemType, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, (self._w, 'insert', index, itemType) 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										      + self._options(cnf, kw))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def insert_cascade(self, index, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.insert(index, 'cascade', cnf or kw)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def insert_checkbutton(self, index, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.insert(index, 'checkbutton', cnf or kw)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def insert_command(self, index, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.insert(index, 'command', cnf or kw)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def insert_radiobutton(self, index, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.insert(index, 'radiobutton', cnf or kw)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def insert_separator(self, index, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.insert(index, 'separator', cnf or kw)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def delete(self, index1, index2=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'delete', index1, index2)
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fixed several bugs reported by Greg McFarmane:
 *  The invoke methods of the three Tkinter widgets Button,
    Checkbutton and Radiobutton should return the value returned by
    the callback, (like the Menu widget does):
	def invoke(self):
	    return self.tk.call(self._w, 'invoke')
 *  The select_from method of the Canvas widget should use 'from', not
    'set':
	def select_from(self, tagOrId, index):
	    self.tk.call(self._w, 'select', 'from', tagOrId, index)
    Currently, if you use select_from, you get the error message:
 'TclError: bad select option "set": must be adjust, clear, from, item, or to'
 *  The 'entrycget' and 'type' methods of the Tk menu widget are
    missing from Tkinter.
 *  There is a bug in grid_columnconfigure and grid_rowconfigure.  For
    example, this should return the current value of the 'minsize'
    option for column 0:
	f.grid_columnconfigure(0, 'minsize')
    Instead it returns the same as:
	f.grid_columnconfigure(0)
    I suggest that the hint given in the comment in the
    Tkinter.Misc.configure method should be followed - "ought to
    generalize this so tag_config etc.  can use it".  Repeating the
    same configure code several times in Tkinter is inviting errors.
    [I did not follow this advice --G]
 *  The grid_slaves method should handle options.  Currently, to pass
    options to the grid_slaves method, you have to do something like:
	grid_slaves('-row', 1)
											
										 
										
											1997-12-29 19:59:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def entrycget(self, index, option):
							 | 
						
					
						
							
								
									
										
										
										
											1997-12-30 04:07:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self.tk.call(self._w, 'entrycget', index, '-' + option)
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def entryconfigure(self, index, cnf=None, **kw):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if cnf is None and not kw:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											cnf = {}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											for x in self.tk.split(apply(self.tk.call,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											    (self._w, 'entryconfigure', index))):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												cnf[x[0][1:]] = (x[0][1:],) + x[1:]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return cnf
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if type(cnf) == StringType and not kw:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											x = self.tk.split(apply(self.tk.call,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											    (self._w, 'entryconfigure', index, '-'+cnf)))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return (x[0][1:],) + x[1:]
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, (self._w, 'entryconfigure', index)
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										      + self._options(cnf, kw))
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									entryconfig = entryconfigure
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def index(self, index):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:59 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										i = self.tk.call(self._w, 'index', index)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if i == 'none': return None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(i)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def invoke(self, index):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call(self._w, 'invoke', index)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def post(self, x, y):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'post', x, y)
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fixed several bugs reported by Greg McFarmane:
 *  The invoke methods of the three Tkinter widgets Button,
    Checkbutton and Radiobutton should return the value returned by
    the callback, (like the Menu widget does):
	def invoke(self):
	    return self.tk.call(self._w, 'invoke')
 *  The select_from method of the Canvas widget should use 'from', not
    'set':
	def select_from(self, tagOrId, index):
	    self.tk.call(self._w, 'select', 'from', tagOrId, index)
    Currently, if you use select_from, you get the error message:
 'TclError: bad select option "set": must be adjust, clear, from, item, or to'
 *  The 'entrycget' and 'type' methods of the Tk menu widget are
    missing from Tkinter.
 *  There is a bug in grid_columnconfigure and grid_rowconfigure.  For
    example, this should return the current value of the 'minsize'
    option for column 0:
	f.grid_columnconfigure(0, 'minsize')
    Instead it returns the same as:
	f.grid_columnconfigure(0)
    I suggest that the hint given in the comment in the
    Tkinter.Misc.configure method should be followed - "ought to
    generalize this so tag_config etc.  can use it".  Repeating the
    same configure code several times in Tkinter is inviting errors.
    [I did not follow this advice --G]
 *  The grid_slaves method should handle options.  Currently, to pass
    options to the grid_slaves method, you have to do something like:
	grid_slaves('-row', 1)
											
										 
										
											1997-12-29 19:59:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def type(self, index):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call(self._w, 'type', index)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def unpost(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'unpost')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def yposition(self, index):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self._w, 'yposition', index))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Menubutton(Widget):
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, master=None, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Widget.__init__(self, master, 'menubutton', cnf, kw)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Message(Widget):
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, master=None, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Widget.__init__(self, master, 'message', cnf, kw)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Radiobutton(Widget):
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, master=None, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Widget.__init__(self, master, 'radiobutton', cnf, kw)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def deselect(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'deselect')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def flash(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'flash')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def invoke(self):
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Fixed several bugs reported by Greg McFarmane:
 *  The invoke methods of the three Tkinter widgets Button,
    Checkbutton and Radiobutton should return the value returned by
    the callback, (like the Menu widget does):
	def invoke(self):
	    return self.tk.call(self._w, 'invoke')
 *  The select_from method of the Canvas widget should use 'from', not
    'set':
	def select_from(self, tagOrId, index):
	    self.tk.call(self._w, 'select', 'from', tagOrId, index)
    Currently, if you use select_from, you get the error message:
 'TclError: bad select option "set": must be adjust, clear, from, item, or to'
 *  The 'entrycget' and 'type' methods of the Tk menu widget are
    missing from Tkinter.
 *  There is a bug in grid_columnconfigure and grid_rowconfigure.  For
    example, this should return the current value of the 'minsize'
    option for column 0:
	f.grid_columnconfigure(0, 'minsize')
    Instead it returns the same as:
	f.grid_columnconfigure(0)
    I suggest that the hint given in the comment in the
    Tkinter.Misc.configure method should be followed - "ought to
    generalize this so tag_config etc.  can use it".  Repeating the
    same configure code several times in Tkinter is inviting errors.
    [I did not follow this advice --G]
 *  The grid_slaves method should handle options.  Currently, to pass
    options to the grid_slaves method, you have to do something like:
	grid_slaves('-row', 1)
											
										 
										
											1997-12-29 19:59:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self.tk.call(self._w, 'invoke')
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def select(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'select')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Scale(Widget):
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, master=None, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Widget.__init__(self, master, 'scale', cnf, kw)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def get(self):
							 | 
						
					
						
							
								
									
										
										
										
											1996-10-23 14:16:28 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										value = self.tk.call(self._w, 'get')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										try:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return self.tk.getint(value)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										except TclError:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return self.tk.getdouble(value)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def set(self, value):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'set', value)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Scrollbar(Widget):
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, master=None, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Widget.__init__(self, master, 'scrollbar', cnf, kw)
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def activate(self, index):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'activate', index)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def delta(self, deltax, deltay):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.getdouble(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self._w, 'delta', deltax, deltay))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def fraction(self, x, y):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.getdouble(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self._w, 'fraction', x, y))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def identify(self, x, y):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call(self._w, 'identify', x, y)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def get(self):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self._getdoubles(self.tk.call(self._w, 'get'))
							 | 
						
					
						
							
								
									
										
										
										
											1995-07-14 15:29:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def set(self, *args):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, (self._w, 'set')+args)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Text(Widget):
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, master=None, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Widget.__init__(self, master, 'text', cnf, kw)
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def bbox(self, *args):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._getints(self._do('bbox', args)) or None
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tk_textSelectTo(self, index):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('tk_textSelectTo', self._w, index)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tk_textBackspace(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('tk_textBackspace', self._w)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tk_textIndexCloser(self, a, b, c):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('tk_textIndexCloser', self._w, a, b, c)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tk_textResetAnchor(self, index):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call('tk_textResetAnchor', self._w, index)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def compare(self, index1, op, index2):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getboolean(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self._w, 'compare', index1, op, index2))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def debug(self, boolean=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getboolean(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self._w, 'debug', boolean))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def delete(self, index1, index2=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'delete', index1, index2)
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def dlineinfo(self, index):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._getints(self.tk.call(self._w, 'dlineinfo', index))
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def get(self, index1, index2=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call(self._w, 'get', index1, index2)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def index(self, index):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call(self._w, 'index', index)
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def insert(self, index, chars, *args):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, (self._w, 'insert', index, chars)+args)
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def mark_gravity(self, markName, direction=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return apply(self.tk.call,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											     (self._w, 'mark', 'gravity', markName, direction))
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def mark_names(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.splitlist(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self._w, 'mark', 'names'))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def mark_set(self, markName, index):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'mark', 'set', markName, index)
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def mark_unset(self, *markNames):
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, (self._w, 'mark', 'unset') + markNames)
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def scan_mark(self, x, y):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'scan', 'mark', x, y)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def scan_dragto(self, x, y):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'scan', 'dragto', x, y)
							 | 
						
					
						
							
								
									
										
										
										
											1995-09-30 17:05:26 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def search(self, pattern, index, stopindex=None,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										   forwards=None, backwards=None, exact=None,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										   regexp=None, nocase=None, count=None):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										args = [self._w, 'search']
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if forwards: args.append('-forwards')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if backwards: args.append('-backwards')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if exact: args.append('-exact')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if regexp: args.append('-regexp')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if nocase: args.append('-nocase')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if count: args.append('-count'); args.append(count)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if pattern[0] == '-': args.append('--')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										args.append(pattern)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										args.append(index)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if stopindex: args.append(stopindex)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return apply(self.tk.call, tuple(args))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def see(self, index):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'see', index)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tag_add(self, tagName, index1, index2=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self._w, 'tag', 'add', tagName, index1, index2)
							 | 
						
					
						
							
								
									
										
										
										
											1998-03-27 21:26:51 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def tag_unbind(self, tagName, sequence, funcid=None):
							 | 
						
					
						
							
								
									
										
										
										
											1994-08-08 12:47:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'tag', 'bind', tagName, sequence, '')
							 | 
						
					
						
							
								
									
										
										
										
											1998-03-27 21:26:51 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if funcid:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.deletecommand(funcid)
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def tag_bind(self, tagName, sequence, func, add=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self._bind((self._w, 'tag', 'bind', tagName),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												  sequence, func, add)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tag_cget(self, tagName, option):
							 | 
						
					
						
							
								
									
										
										
										
											1996-11-11 19:10:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if option[:1] != '-':
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											option = '-' + option
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if option[-1:] == '_':
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											option = option[:-1]
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self.tk.call(self._w, 'tag', 'cget', tagName, option)
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def tag_configure(self, tagName, cnf={}, **kw):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if type(cnf) == StringType:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											x = self.tk.split(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												self._w, 'tag', 'configure', tagName, '-'+cnf))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return (x[0][1:],) + x[1:]
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, 
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										      (self._w, 'tag', 'configure', tagName)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										      + self._options(cnf, kw))
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									tag_config = tag_configure
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-06 09:23:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def tag_delete(self, *tagNames):
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-06 10:20:11 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, (self._w, 'tag', 'delete') + tagNames)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tag_lower(self, tagName, belowThis=None):
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-07 13:12:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self._w, 'tag', 'lower', tagName, belowThis)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tag_names(self, index=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.splitlist(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call(self._w, 'tag', 'names', index))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tag_nextrange(self, tagName, index1, index2=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.splitlist(self.tk.call(
							 | 
						
					
						
							
								
									
										
										
										
											1995-03-20 15:09:13 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											self._w, 'tag', 'nextrange', tagName, index1, index2))
							 | 
						
					
						
							
								
									
										
										
										
											1997-12-15 17:31:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def tag_prevrange(self, tagName, index1, index2=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.splitlist(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self._w, 'tag', 'prevrange', tagName, index1, index2))
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tag_raise(self, tagName, aboveThis=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self._w, 'tag', 'raise', tagName, aboveThis)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tag_ranges(self, tagName):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.splitlist(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self._w, 'tag', 'ranges', tagName))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def tag_remove(self, tagName, index1, index2=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(
							 | 
						
					
						
							
								
									
										
										
										
											1994-07-06 21:16:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											self._w, 'tag', 'remove', tagName, index1, index2)
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def window_cget(self, index, option):
							 | 
						
					
						
							
								
									
										
										
										
											1997-12-11 17:08:52 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if option[:1] != '-':
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											option = '-' + option
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if option[-1:] == '_':
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											option = option[:-1]
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return self.tk.call(self._w, 'window', 'cget', index, option)
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def window_configure(self, index, cnf={}, **kw):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if type(cnf) == StringType:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											x = self.tk.split(self.tk.call(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												self._w, 'window', 'configure',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												index, '-'+cnf))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return (x[0][1:],) + x[1:]
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										      (self._w, 'window', 'configure', index)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										      + self._options(cnf, kw))
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									window_config = window_configure
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def window_create(self, index, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										      (self._w, 'window', 'create', index)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										      + self._options(cnf, kw))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def window_names(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.splitlist(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call(self._w, 'window', 'names'))
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def xview(self, *what):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if not what:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return self._getdoubles(self.tk.call(self._w, 'xview'))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, (self._w, 'xview')+what)
							 | 
						
					
						
							
								
									
										
										
										
											1995-07-14 15:29:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def yview(self, *what):
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if not what:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return self._getdoubles(self.tk.call(self._w, 'yview'))
							 | 
						
					
						
							
								
									
										
										
										
											1995-07-14 15:29:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, (self._w, 'yview')+what)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def yview_pickplace(self, *what):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, (self._w, 'yview', '-pickplace')+what)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-20 07:49:28 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1996-10-21 15:16:51 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								class _setit:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def __init__(self, var, value):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.__value = value
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.__var = var
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def __call__(self, *args):
							 | 
						
					
						
							
								
									
										
										
										
											1996-10-21 17:09:31 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.__var.set(self.__value)
							 | 
						
					
						
							
								
									
										
										
										
											1996-10-21 15:16:51 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class OptionMenu(Menubutton):
							 | 
						
					
						
							
								
									
										
										
										
											1995-09-01 20:35:37 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, master, variable, value, *values):
							 | 
						
					
						
							
								
									
										
										
										
											1996-10-21 15:16:51 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										kw = {"borderwidth": 2, "textvariable": variable,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										      "indicatoron": 1, "relief": RAISED, "anchor": "c",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										      "highlightthickness": 2}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Widget.__init__(self, master, "menubutton", kw)
							 | 
						
					
						
							
								
									
										
										
										
											1995-09-01 20:35:37 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.widgetName = 'tk_optionMenu'
							 | 
						
					
						
							
								
									
										
										
										
											1996-10-21 15:16:51 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										menu = self.__menu = Menu(self, name="menu", tearoff=0)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.menuname = menu._w
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										menu.add_command(label=value, command=_setit(variable, value))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										for v in values:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											menu.add_command(label=v, command=_setit(variable, v))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self["menu"] = menu
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def __getitem__(self, name):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if name == 'menu':
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return self.__menu
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return Widget.__getitem__(self, name)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def destroy(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Menubutton.destroy(self)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.__menu = None
							 | 
						
					
						
							
								
									
										
										
										
											1995-09-01 20:35:37 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								class Image:
							 | 
						
					
						
							
								
									
										
										
										
											1998-03-20 20:45:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, imgtype, name=None, cnf={}, master=None, **kw):
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.name = None
							 | 
						
					
						
							
								
									
										
										
										
											1998-03-20 20:45:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if not master:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											master = _default_root
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											if not master:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												raise RuntimeError, 'Too early to create image'
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.tk = master.tk
							 | 
						
					
						
							
								
									
										
										
										
											1996-11-20 22:17:38 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if not name:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											name = `id(self)`
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											# The following is needed for systems where id(x)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											# can return a negative number, such as Linux/m68k:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											if name[0] == '-': name = '_' + name[1:]
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if kw and cnf: cnf = _cnfmerge((cnf, kw))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										elif kw: cnf = kw
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										options = ()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										for k, v in cnf.items():
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											if callable(v):
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
												v = self._register(v)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											options = options + ('-'+k, v)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										      ('image', 'create', imgtype, name,) + options)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.name = name
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def __str__(self): return self.name
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def __del__(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if self.name:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('image', 'delete', self.name)
							 | 
						
					
						
							
								
									
										
										
										
											1995-09-18 21:54:35 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __setitem__(self, key, value):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self.name, 'configure', '-'+key, value)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def __getitem__(self, key):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call(self.name, 'configure', '-'+key)
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def configure(self, **kw):
							 | 
						
					
						
							
								
									
										
										
										
											1996-12-27 15:33:17 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										res = ()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										for k, v in _cnfmerge(kw).items():
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											if v is not None:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												if k[-1] == '_': k = k[:-1]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												if callable(v):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													v = self._register(v)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												res = res + ('-'+k, v)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, (self.name, 'config') + res)
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									config = configure
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def height(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('image', 'height', self.name))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def type(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call('image', 'type', self.name)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def width(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.getint(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											self.tk.call('image', 'width', self.name))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class PhotoImage(Image):
							 | 
						
					
						
							
								
									
										
										
										
											1998-03-20 20:45:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, name=None, cnf={}, master=None, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply(Image.__init__, (self, 'photo', name, cnf, master), kw)
							 | 
						
					
						
							
								
									
										
										
										
											1995-09-30 17:05:26 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def blank(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(self.name, 'blank')
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def cget(self, option):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call(self.name, 'cget', '-' + option)
							 | 
						
					
						
							
								
									
										
										
										
											1995-09-30 17:05:26 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									# XXX config
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __getitem__(self, key):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call(self.name, 'cget', '-' + key)
							 | 
						
					
						
							
								
									
										
										
										
											1997-12-11 02:03:55 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									# XXX copy -from, -to, ...?
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def copy(self):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										destImage = PhotoImage()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(destImage, 'copy', self.name)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return destImage
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def zoom(self,x,y=''):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										destImage = PhotoImage()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if y=='': y=x
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(destImage, 'copy', self.name, '-zoom',x,y)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return destImage
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def subsample(self,x,y=''):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										destImage = PhotoImage()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if y=='': y=x
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.tk.call(destImage, 'copy', self.name, '-subsample',x,y)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return destImage
							 | 
						
					
						
							
								
									
										
										
										
											1995-09-30 17:05:26 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def get(self, x, y):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return self.tk.call(self.name, 'get', x, y)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									def put(self, data, to=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										args = (self.name, 'put', data)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if to:
							 | 
						
					
						
							
								
									
										
										
										
											1997-12-16 15:03:43 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											if to[0] == '-to':
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
												to = to[1:]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											args = args + ('-to',) + tuple(to)
							 | 
						
					
						
							
								
									
										
										
										
											1995-09-30 17:05:26 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, args)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									# XXX read
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def write(self, filename, format=None, from_coords=None):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										args = (self.name, 'write', filename)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if format:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											args = args + ('-format', format)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										if from_coords:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											args = args + ('-from',) + tuple(from_coords)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply(self.tk.call, args)
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class BitmapImage(Image):
							 | 
						
					
						
							
								
									
										
										
										
											1998-03-20 20:45:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, name=None, cnf={}, master=None, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										apply(Image.__init__, (self, 'bitmap', name, cnf, master), kw)
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								def image_names(): return _default_root.tk.call('image', 'names')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								def image_types(): return _default_root.tk.call('image', 'types')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								######################################################################
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Extensions:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Studbutton(Button):
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, master=None, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Widget.__init__(self, master, 'studbutton', cnf, kw)
							 | 
						
					
						
							
								
									
										
										
										
											1995-07-14 15:29:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.bind('<Any-Enter>',       self.tkButtonEnter)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.bind('<Any-Leave>',       self.tkButtonLeave)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.bind('<1>',               self.tkButtonDown)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.bind('<ButtonRelease-1>', self.tkButtonUp)
							 | 
						
					
						
							
								
									
										
										
										
											1994-06-27 07:55:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Tributton(Button):
							 | 
						
					
						
							
								
									
										
										
										
											1995-08-04 03:50:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									def __init__(self, master=None, cnf={}, **kw):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Widget.__init__(self, master, 'tributton', cnf, kw)
							 | 
						
					
						
							
								
									
										
										
										
											1995-07-14 15:29:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										self.bind('<Any-Enter>',       self.tkButtonEnter)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.bind('<Any-Leave>',       self.tkButtonLeave)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.bind('<1>',               self.tkButtonDown)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self.bind('<ButtonRelease-1>', self.tkButtonUp)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self['fg']               = self['bg']
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										self['activebackground'] = self['bg']
							 | 
						
					
						
							
								
									
										
										
										
											1996-05-16 16:00:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1996-08-21 23:38:59 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								######################################################################
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Test:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								def _test():
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									root = Tk()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									label = Label(root, text="Proof-of-existence test for Tk")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									label.pack()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									test = Button(root, text="Click me!",
							 | 
						
					
						
							
								
									
										
										
										
											1997-11-07 20:38:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										      command=lambda root=root: root.test.configure(
							 | 
						
					
						
							
								
									
										
										
										
											1996-08-21 23:38:59 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											      text="[%s]" % root.test['text']))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									test.pack()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									root.test = test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									quit = Button(root, text="QUIT", command=root.destroy)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									quit.pack()
							 | 
						
					
						
							
								
									
										
										
										
											1997-05-09 00:59:43 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									root.tkraise()
							 | 
						
					
						
							
								
									
										
										
										
											1996-08-21 23:38:59 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									root.mainloop()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								if __name__ == '__main__':
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									_test()
							 |