summaryrefslogtreecommitdiffstats
path: root/Lib/lib-tk
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1994-06-20 09:09:51 (GMT)
committerGuido van Rossum <guido@python.org>1994-06-20 09:09:51 (GMT)
commit1e9e400ba72993dacbaa12e7d2ed48109a1365dc (patch)
tree028b88b02b3f0c3c23ad3ed3888e7e9c92f22b7e /Lib/lib-tk
parentdf09691e7cfa9e0354b2be3d0b28a2c0ad2deb64 (diff)
downloadcpython-1e9e400ba72993dacbaa12e7d2ed48109a1365dc.zip
cpython-1e9e400ba72993dacbaa12e7d2ed48109a1365dc.tar.gz
cpython-1e9e400ba72993dacbaa12e7d2ed48109a1365dc.tar.bz2
Added getdouble, getboolean.
Removed redundant global statements getboolean returns None if argument is empty AtInsert() concatenates optional arguments after 'insert'
Diffstat (limited to 'Lib/lib-tk')
-rw-r--r--Lib/lib-tk/Tkinter.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py
index 951a1d6..c9d8966 100644
--- a/Lib/lib-tk/Tkinter.py
+++ b/Lib/lib-tk/Tkinter.py
@@ -30,6 +30,10 @@ class Misc:
return self.tk.getvar(name)
def getint(self, s):
return self.tk.getint(s)
+ def getdouble(self, s):
+ return self.tk.getdouble(s)
+ def getboolean(self, s):
+ return self.tk.getboolean(s)
def focus(self):
self.tk.call('focus', self._w)
def focus_default(self):
@@ -183,19 +187,16 @@ class Misc:
def update_idletasks(self):
self.tk.call('update', 'idletasks')
def bind(self, sequence, func, add=''):
- global _substitute, _subst_prefix
if add: add = '+'
name = self._register(func, _substitute)
self.tk.call('bind', self._w, sequence,
(add + name,) + _subst_prefix)
def bind_all(self, sequence, func, add=''):
- global _substitute, _subst_prefix
if add: add = '+'
name = self._register(func, _substitute)
self.tk.call('bind', 'all' , sequence,
(add + `name`,) + _subst_prefix)
def bind_class(self, className, sequence, func, add=''):
- global _substitute, _subst_prefix
if add: add = '+'
name = self._register(func, _substitute)
self.tk.call('bind', className , sequence,
@@ -216,8 +217,7 @@ class Misc:
def _getboolean(self, string):
if string:
return self.tk.getboolean(string)
- else:
- return string
+ # else return None
def _options(self, cnf):
res = ()
for k, v in cnf.items():
@@ -242,8 +242,6 @@ _subst_prefix = ('%#', '%b', '%f', '%h', '%k',
'%A', '%E', '%K', '%N', '%T', '%X', '%Y')
def _substitute(*args):
- global default_root
- global _subst_prefix
tk = default_root.tk
if len(args) != len(_subst_prefix): return args
nsign, b, f, h, k, s, t, w, x, y, A, E, K, N, T, X, Y = args
@@ -503,8 +501,11 @@ class Button(Widget):
# Indices:
def AtEnd():
return 'end'
-def AtInsert():
- return 'insert'
+def AtInsert(*args):
+ s = 'insert'
+ for a in args:
+ if a: s = s + (' ' + a)
+ return s
def AtSelFirst():
return 'sel.first'
def AtSelLast():
@@ -523,7 +524,6 @@ class Canvas(Widget):
def bbox(self, *args):
return self._getints(self._do('bbox', args))
def bind(self, tagOrId, sequence, func, add=''):
- global _substitute, _subst_prefix
if add: add='+'
name = self._register(func, _substitute)
self.tk.call(self._w, 'bind', tagOrId, sequence,
@@ -844,7 +844,6 @@ class Text(Widget):
self.tk.call(
self._w, 'tag', 'add', tagName, index1, index2)
def tag_bind(self, tagName, sequence, func, add=''):
- global _substitute, _subst_prefix
if add: add='+'
name = self._register(func, _substitute)
self.tk.call(self._w, 'tag', 'bind',