[issue2693] IDLE doesn't work with Tk 8.5

2008-12-31 Thread Guilherme Polo

Guilherme Polo ggp...@gmail.com added the comment:

Closing as only r59654 was backported to release25-maint, so Tk 8.5 is
not fully supported by the standard Tkinter present in python 2.5.x

--
resolution:  - wont fix
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2693
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2693] IDLE doesn't work with Tk 8.5 under python 2.5 and older

2008-12-31 Thread Guilherme Polo

Changes by Guilherme Polo ggp...@gmail.com:


--
title: IDLE  doesn't work with Tk 8.5 - IDLE  doesn't work with Tk 8.5 under 
python 2.5 and older

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2693
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2693] IDLE doesn't work with Tk 8.5

2008-08-16 Thread Guilherme Polo

Guilherme Polo [EMAIL PROTECTED] added the comment:

Hi there,

The revisions you are after are r59653 and r59654.
I really don't see a reason to not patch release25-maint with those ones.

--
nosy: +gpolo

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2693
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2693] IDLE doesn't work with Tk 8.5

2008-04-29 Thread Greg Couch

Greg Couch [EMAIL PROTECTED] added the comment:

Starting over:

The goal of this patch is to get Tk 8.5 to work with Python 2.5's Idle.
 It currently fails with a ValueError, invalid literal for int() with
base 10: '(72,' (the 72 changes depending on what was typed in).

The root cause of bug is due to an interaction between Tk 8.5 returning
more results as Tcl lists, instances of Idle's WidgetRedirector class
that wrap widget Tcl commands with the WidgetRedirector's dispatch
method, and _tkinter's internal PythonCmd function that stringifies
anything its gets from Python.  What happens is that when a Python
method is called on a redirected widget, the corresponding Tcl method is
called using the WidgetRedirector's imposter widget command, which calls
the WidgetRedirector's dispatch method from Tcl, which then invokes the
original widget Tcl command, and if that command returns a Tcl list,
_tkinter converts it to a Python tuple, the dispatch method returns the
tuple into _tkinter, _tkinter stringifies it so it looks like a Python
tuple representation instead of a Tcl list representation, returns it to
Tkinter which tries to parse it like a Tcl list representation, and
causes the ValueError.

The correct fix is already in Python 2.6a2, which is changing Text
class' index method in Tkinter.py to return a string, and changing
_tkinter's PythonCmd to convert Python objects to equivalent Tcl
objects.  Unfortunately backporting those simple changes to Python 2.5
cause a SystemError: Objects/tupleobject.c:89: bad argument to internal
function.  While that is worth further investigation, Python 2.6a2
doesn't have that problem and a simple alternative fix is available for
Python 2.5, so that is for someone else to do.

The alternative fix that works in Python 2.5 is to make sure that the
Tcl list string representation is used for Python tuples that are
returned to _tkinter's PythonCmd.  Those changes are confined to the
WidgetRedirector's dispatch method.  Line 126 of WidgetRedirector.py:

return self.tk.call((self.orig, operation) + args)

is replaced with:

result = self.tk.call((self.orig, operation) + args)
if isinstance(result, tuple):
# convert to string ourselves so we get a Tcl list
# that can be converted back into a tuple by Tkinter
result = '{%s}' % '} {'.join(map(str, result))
return result

For Tk 8.4, the if clause is never invoked because Idle does not use any
of the Tk 8.4 methods that return Tcl lists (luckily).  In Tk 8.5, the
additional quoting is only needed for the Tk text widget's tag names and
tag ranges commands when spaces are used for tag names (explicitly not
recommended), all other uses are lists of numbers.  Since none of Idle's
Text tags have spaces in them, that line can safely be replaced with:

result = ' '.join(map(str, result))

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2693
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2693] IDLE doesn't work with Tk 8.5

2008-04-27 Thread Martin v. Löwis

Martin v. Löwis [EMAIL PROTECTED] added the comment:

 I wish I could be as cavalier about Tk 8.5.  The last version of Tk 8.4
 just came out and it really shows its age, especially on Mac OS X, and
 those are ~25% of our application's downloads.

Still, why is that a problem to use it for IDLE?

 Since Python 2.6a2 is
 not suitable for production use, that leaves us with patching 2.5. 

If you need to patch Python 2.5, just go ahead and do it. You don't need
your patch accepted for that. Python 2.5.3 will likely be released
*after* Python 2.6, at which point the not suitable for production use
argument will be invalid.

 Backporting, the _tkinter and Tkinter changes, was not hard, but then we
 get SystemError: Objects/tupleobject.c:89: bad argument to internal
 function errors with both the 2.5 and the 2.6a2 idlelibs.  Looking at
 the SVN log, it is not clear which patch to tupleobject.c fixed that
 problem (does anyone know?).

I don't think there was any such change to tupleobject.c. If you got
the internal error after changing something, you probably changed it
incorrectly.

 So fixing WidgetRedirector.py to not screw up the string representation
 of tuples is the easiest solution to get idle to work with Tk 8.5. and
 Python 2.5 (you still would want the Tkinter.py changes for other
 reasons).  A slightly more robust solution would be to use Tcl quoting:
 
 r = '{%s}' % '} {'.join(map(str, r))
 
 But that has not been important in practice.

This is what I'm concerned about. I cannot accept a patch whose
correctness was just established through testing. In fact, I don't
understand what the proposed change actually does: what are the
values of the variables at the point, what is the expected result,
what is the actual result, and how does the patch change that?

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2693
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2693] IDLE doesn't work with Tk 8.5

2008-04-27 Thread Kurt B. Kaiser

Changes by Kurt B. Kaiser [EMAIL PROTECTED]:


--
nosy: +kbk

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2693
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2693] IDLE doesn't work with Tk 8.5

2008-04-26 Thread Greg Couch

Greg Couch [EMAIL PROTECTED] added the comment:

I wish I could be as cavalier about Tk 8.5.  The last version of Tk 8.4
just came out and it really shows its age, especially on Mac OS X, and
those are ~25% of our application's downloads.  Since Python 2.6a2 is
not suitable for production use, that leaves us with patching 2.5. 
Backporting, the _tkinter and Tkinter changes, was not hard, but then we
get SystemError: Objects/tupleobject.c:89: bad argument to internal
function errors with both the 2.5 and the 2.6a2 idlelibs.  Looking at
the SVN log, it is not clear which patch to tupleobject.c fixed that
problem (does anyone know?).

So fixing WidgetRedirector.py to not screw up the string representation
of tuples is the easiest solution to get idle to work with Tk 8.5. and
Python 2.5 (you still would want the Tkinter.py changes for other
reasons).  A slightly more robust solution would be to use Tcl quoting:

r = '{%s}' % '} {'.join(map(str, r))

But that has not been important in practice.

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2693
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2693] IDLE doesn't work with Tk 8.5

2008-04-25 Thread Greg Couch

New submission from Greg Couch [EMAIL PROTECTED]:

IDLE and Tk 8.5 don't well work together for both Python 2.5 and 2.6a
(SVN version).  The reasons are related but different.

In Python 2.5, you can't select any text in the IDLE window and whenever
a calltip is to appear, you get a backtrace ending with invalid literal
for int() with base 10: '(72,'.  That comes from an interaction between
WidgetRedirector's dispatch function and _tkinter.  The Text widget's
bbox method returns a tuple of ints, the dispatch function isn't
monitoring bbox, so it returns the tuple as is to _tkinter, where
PythonCmd converts the tuple to a Python string, not a Tcl list, so when
Tkinter sees the string, it can't convert to a tuple.

The Python 2.6a2 SVN version of _tkinter fixes that bug but exposes
others (Ikinter.py, tupleobject.c), so I've attached a simple patch for
Python 2.5.  The SVN version of idle appears to work, so this patch
should only be on the 2.5 branch.

--
components: IDLE, Tkinter
files: Python-2.5.2-idlelib.patch
keywords: patch
messages: 65828
nosy: gregc
severity: normal
status: open
title: IDLE  doesn't work with Tk 8.5
versions: Python 2.5
Added file: http://bugs.python.org/file10112/Python-2.5.2-idlelib.patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2693
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2693] IDLE doesn't work with Tk 8.5

2008-04-25 Thread Martin v. Löwis

Martin v. Löwis [EMAIL PROTECTED] added the comment:

I'm skeptical about this patch; it may break other things. So Python 2.5
just doesn't support Tcl 8.5 - you need to stay with Tcl 8.4.

--
nosy: +loewis

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2693
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com