Tkinter / Idle weirdness

Henk Csaba tphhec01 at degas.ceu.hu
Wed May 21 05:56:17 EDT 2003


Hello!

I installed Python-2.2.2 + Tcl/Tk on my Linux + glibc-2.2.5 + gcc-3.1 system 
from source. 

I experienced some weird behaviour that I didn't see at other installations 
I could put my hand on: when I started Idle, it stood up, but doing *any* 
action (pressing buttons, clicking mouse) it spit an error message like 
this (and failed to perform the action):

Exception in Tkinter callback
Traceback (most recent call last):
  File "./Tkinter.py", line 1299, in __call__
    args = apply(self.subst, args)
  File "./Tkinter.py", line 1032, in _substitute
    e.num = getint(b)
ValueError: invalid literal for int(): ??

I could cure the problem by hacking Tkinter.py as the following patch shows:

--- save/Tkinter.py     2003-05-19 03:19:00.000000000 +0200
+++ Tkinter.py  2003-05-20 21:17:54.000000000 +0200
@@ -1024,7 +1024,12 @@
         """Internal function."""
         if len(args) != len(self._subst_format): return args
         getboolean = self.tk.getboolean
-        getint = int
+# getint = int was not OK, there were always ValueErrors. A solution
+# like at e.state below was needed for the whole of this function
+        def getint(x):
+               try: return int(x)
+               except ValueError: return x 
+# End of patch of Csaba Henk (ekho at renyi.hu)
         nsign, b, f, h, k, s, t, w, x, y, A, E, K, N, W, T, X, Y, D = args
         # Missing: (a, c, d, m, o, v, B, R)
         e = Event()

I couldn't reproduce this error on other installations I could put my hands on. 
Whose bug is it? Python or my system? Has anybody ever seen anybody like this?

Csaba  




More information about the Python-list mailing list