summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-11-20 22:17:38 (GMT)
committerGuido van Rossum <guido@python.org>1996-11-20 22:17:38 (GMT)
commit58103d3b114cedd5dabc9cc06b3e800178324433 (patch)
tree6a0826a120f71c38790afd705c287f6c44813f17 /Lib
parent27cb8a4884d58b2d42fcdb10e3c9c1bde7a97cf7 (diff)
downloadcpython-58103d3b114cedd5dabc9cc06b3e800178324433.zip
cpython-58103d3b114cedd5dabc9cc06b3e800178324433.tar.gz
cpython-58103d3b114cedd5dabc9cc06b3e800178324433.tar.bz2
Turn leading minus sign into underscore for image widget name -- the
hyphen confused Tk into thinking the name was an option.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/lib-tk/Tkinter.py8
-rwxr-xr-xLib/tkinter/Tkinter.py8
2 files changed, 10 insertions, 6 deletions
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py
index 5dd0c99..c482f46 100644
--- a/Lib/lib-tk/Tkinter.py
+++ b/Lib/lib-tk/Tkinter.py
@@ -54,7 +54,6 @@ def _cnfmerge(cnfs):
if type(cnfs) is DictionaryType:
return cnfs
elif type(cnfs) in (NoneType, StringType):
-
return cnfs
else:
cnf = {}
@@ -1531,7 +1530,6 @@ class _setit:
def __init__(self, var, value):
self.__value = value
self.__var = var
-
def __call__(self, *args):
self.__var.set(self.__value)
@@ -1564,7 +1562,11 @@ class Image:
master = _default_root
if not master: raise RuntimeError, 'Too early to create image'
self.tk = master.tk
- if not name: name = `id(self)`
+ 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:]
if kw and cnf: cnf = _cnfmerge((cnf, kw))
elif kw: cnf = kw
options = ()
diff --git a/Lib/tkinter/Tkinter.py b/Lib/tkinter/Tkinter.py
index 5dd0c99..c482f46 100755
--- a/Lib/tkinter/Tkinter.py
+++ b/Lib/tkinter/Tkinter.py
@@ -54,7 +54,6 @@ def _cnfmerge(cnfs):
if type(cnfs) is DictionaryType:
return cnfs
elif type(cnfs) in (NoneType, StringType):
-
return cnfs
else:
cnf = {}
@@ -1531,7 +1530,6 @@ class _setit:
def __init__(self, var, value):
self.__value = value
self.__var = var
-
def __call__(self, *args):
self.__var.set(self.__value)
@@ -1564,7 +1562,11 @@ class Image:
master = _default_root
if not master: raise RuntimeError, 'Too early to create image'
self.tk = master.tk
- if not name: name = `id(self)`
+ 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:]
if kw and cnf: cnf = _cnfmerge((cnf, kw))
elif kw: cnf = kw
options = ()