[ python-Bugs-1447234 ] tkinter Dialog fails when more than four buttons are used

SourceForge.net noreply at sourceforge.net
Fri Mar 10 23:30:18 CET 2006


Bugs item #1447234, was opened at 2006-03-10 14:12
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1447234&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Tkinter
Group: Python 2.3
>Status: Closed
>Resolution: Duplicate
Priority: 5
Submitted By: Hernan P. Dacharry (hernanpd)
Assigned to: Martin v. Löwis (loewis)
Summary: tkinter Dialog fails when more than four buttons are used

Initial Comment:
Example code:

#! /usr/bin/env python
import Dialog
from Tkinter import *
root = Tk()
Button(root, text="Hello!").pack()
root.update()
dialog = Dialog.Dialog(None, {'title': 'Test Dialog',
          'text': "Text...",
          'bitmap': '',
          'default': 0,
          'strings':
('Button0','Button1','Button2','Button3','Button4')})
print 'dialog: ', dialog.num


This example works well, except when clicking in
Button4 that fails:
Traceback (most recent call last):
  File "test.py", line 12, in ?
    dialog = Dialog.Dialog(None, {'title': 'Test Dialog',
  File "/usr/lib/python2.3/lib-tk/Dialog.py", line 21,
in __init__
    cnf['bitmap'], cnf['default'],
TypeError: getint() argument 1 must be string, not tuple

I tried to trace the error (learning in the way a
little bit of python and tcl/tk ;)), mostly due to the
bizarre nature of this problem (note that in tcl/tk
there are no problems when creating dialogs with 4 or
more buttons).

In /usr/lib/python2.3/lib-tk/Dialog/py the exception is
raised because it expects a string as the result to the
call to 'tk_dialog', and for some 'obscure' reason (and
I mean it, I even inspected the Tcl/Tk sources looking
for a reason for this) if the call to 'tk_dialog' has
more than 4 buttons (more than 4 string arguments at
the end) it return a tuple with only one element, the
string result.

The impression I got after browsing the sources of
python/tkinter and Tcl/Tk is that this may be caused
because in tcl there is almost no difference between a
list and string, in this way in the tcl language a
string or a list containing only one string are not
really different.

I have this problem when using python2.3 or python2.4
with Tcl/Tk8.4 (in my particular case under
Debian/Testing distribution);

A quick workaround (although I 'm not sure if it would
cause some problems with other things) would be to
change 'workarounds = 1' to 'workarounds = 0' in
Tkinter.py.
Another option would be to change all calls to tk
functions within tkinter that allways expect as a
result a string...

Hernan
(my apologies for making the report so long) 

----------------------------------------------------------------------

>Comment By: Georg Brandl (gbrandl)
Date: 2006-03-10 22:30

Message:
Logged In: YES 
user_id=849994

Duplicate of #1447222.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1447234&group_id=5470


More information about the Python-bugs-list mailing list