error because of tk-8.5.1?

6 views
Skip to first unread message

Vincent Schut

unread,
Feb 27, 2008, 11:53:12 AM2/27/08
to leo-editor
Hi, I'd like to try out leo, but whenever I type something in the body
window, I get the following error. It might be because I have tcl/
tk-8.5.1 installed, which is still alpha iarc? They have antialiasing,
however, which lower versions of tcl/tk lack...

Anyway, the error:

reading settings in /usr/local/lib64/leo/config/leoSettings.leo
reading /home/vincent/.leoRecentFiles.txt
@enabled-plugins found in leoSettings.leo
<type 'exceptions.TypeError'> Exception in Tk callback
Function: <bound method tkinterKeyHandlerClass.masterKeyHandler of
<leoTkinterKeys.tkinterKeyHandlerClass instance at 0x1a46e60>> (type:
<type 'instancemethod'>)
Args: (<Tkinter.Event instance at 0x1a45dd0>,)
Event type: KeyPress (type num: 2)
Traceback (innermost last):
File "/usr/local/lib64/leo/extensions/Pmw/Pmw_1_3/lib/PmwBase.py",
line 1747, in __call__
return apply(self.func, args)
File "/usr/local/lib64/leo/src/leoKeys.py", line 3132, in
masterKeyHandler
return
k.masterCommand(event,func=None,stroke=stroke,commandName=None)
File "/usr/local/lib64/leo/src/leoKeys.py", line 2287, in
masterCommand
val = k.handleDefaultChar(event,stroke)
File "/usr/local/lib64/leo/src/leoKeys.py", line 2336, in
handleDefaultChar
c.editCommands.selfInsertCommand(event,action=action)
File "/usr/local/lib64/leo/src/leoEditCommands.py", line 2964, in
selfInsertCommand
w.setInsertPoint(i+1)
<type 'exceptions.TypeError'>: unsupported operand type(s) for +:
'_tkinter.Tcl_Obj' and 'int'

================================================
Event contents:
char: j
delta: 44
height: ??
keycode: 44
keysym: j
keysym_num: 106
num: ??
send_event: False
serial: 4250
state: 16
time: 1539723536
type: 2
widget: .
29789072.29786768.29694000.29695728.32413528.32413744.body-pane
width: ??
x: 379
x_root: 442
y: 52
y_root: 420

wrote recent file: /home/vincent/.leoRecentFiles.txt

Terry Brown

unread,
Feb 27, 2008, 12:51:30 PM2/27/08
to leo-e...@googlegroups.com
On Wed, 27 Feb 2008 08:53:12 -0800 (PST)
Vincent Schut <VTS...@gmail.com> wrote:

> It might be because I have tcl/
> tk-8.5.1 installed, which is still alpha iarc? They have antialiasing,
> however, which lower versions of tcl/tk lack...

Not directly related to your problem, but my understanding is that Tk
anti-aliasing won't trickle through to Python's Tkinter, and hence to
Leo, until and new Python/Tkinter version, maybe in 2.6, more likely
3.0?

I'd like to be wrong about this, because I'd like anti-aliased Leo, but
this is what I read somewhere. I guess it implies Tkinter will be
relying on Tk 8.4 until the update occurs.

Cheers -Terry

Edward K. Ream

unread,
Feb 27, 2008, 1:00:55 PM2/27/08
to leo-e...@googlegroups.com
On Wed, Feb 27, 2008 at 10:53 AM, Vincent Schut <VTS...@gmail.com> wrote:

Hi, I'd like to try out leo, but whenever I type something in the body
window, I get the following error...
 

<type 'exceptions.TypeError'>: unsupported operand type(s) for +:
'_tkinter.Tcl_Obj' and 'int'

This is a known, very serious, error in Tk/tkinter.  There is a workaround, but it is too ugly to repeat :-)

The best thing to do is to use a version of Tk that isn't broken.

Edward

Vincent Schut

unread,
Feb 28, 2008, 6:17:55 AM2/28/08
to leo-editor
> Not directly related to your problem, but my understanding is that Tk
> anti-aliasing won't trickle through to Python's Tkinter, and hence to
> Leo, until and new Python/Tkinter version, maybe in 2.6, more likely
> 3.0?
>
> I'd like to be wrong about this, because I'd like anti-aliased Leo, but
> this is what I read somewhere. I guess it implies Tkinter will be
> relying on Tk 8.4 until the update occurs.
>
> Cheers -Terry

Hmm, well, I did recompile python after installing tcl/tk 8.5, and leo
looked a lot nicer after that. Also I suddenly had truetype fonts
available in Leo :). So I suppose, it will not be included inofficial
python releases for some time, but if you can build python yourself
you'll have all tk's new features in tkinter, or at least anti-
aliasing and truetype support.

Vincent Schut

unread,
Feb 28, 2008, 6:19:56 AM2/28/08
to leo-editor


On Feb 27, 7:00 pm, "Edward K. Ream" <edream...@gmail.com> wrote:
> On Wed, Feb 27, 2008 at 10:53 AM, Vincent Schut <VTSc...@gmail.com> wrote:
>
> > Hi, I'd like to try out leo, but whenever I type something in the body
> > window, I get the following error...
>
> > <type 'exceptions.TypeError'>: unsupported operand type(s) for +:
> > '_tkinter.Tcl_Obj' and 'int'
>
> This is a known, very serious, error in Tk/tkinter. There is a workaround,
> but it is too ugly to repeat :-)
>
> The best thing to do is to use a version of Tk that isn't broken.

Would there be such version >8.5 that has been officially released? Or
should I use cvs/svn/whatever dev version for that? As far as I could
find, the only available 8.5 version is 8.5.1, which is what I used
(and apparently is broken)...
>
> Edward

Terry Brown

unread,
Feb 28, 2008, 10:50:36 AM2/28/08
to leo-e...@googlegroups.com
On Thu, 28 Feb 2008 03:17:55 -0800 (PST)
Vincent Schut <VTS...@gmail.com> wrote:

> Hmm, well, I did recompile python after installing tcl/tk 8.5, and leo
> looked a lot nicer after that.

Excellent, looks like I'll be compiling python today :-)

I don't know why the open source community is so slow to get to
anti-alias fonts, emacs only just got it's act sorted out in the last
year or so too. I know Gtk has had them for some time, but still.

Cheers -Terry

Terry Brown

unread,
Feb 28, 2008, 1:34:20 PM2/28/08
to leo-e...@googlegroups.com
On Wed, 27 Feb 2008 12:00:55 -0600
"Edward K. Ream" <edre...@gmail.com> wrote:

> > <type 'exceptions.TypeError'>: unsupported operand type(s) for +:
> > '_tkinter.Tcl_Obj' and 'int'
>
> This is a known, very serious, error in Tk/tkinter. There is a
> workaround, but it is too ugly to repeat :-)

But Leo looks so much better with anti-aliased fonts... could you
repeat it anyway? Please?

Cheers -Terry

Terry Brown

unread,
Feb 28, 2008, 2:49:47 PM2/28/08
to leo-e...@googlegroups.com
Hmm, I just found this:

https://sourceforge.net/forum/message.php?msg_id=4078577

which suggests this:

import Tkinter
Tkinter.wantobjects = 0

which does seem to fix the problem.

Well, the traceback on keystroke problem anyway, it's looking as if 8.5
breaks cleo somehow.

Too bad plumloco was abducted by aliens or whatever, gtk is probably
the long term solution to these issues. Hope he's doing ok.

I guess I want to take the Tk specific code out of cleo anyway, so
maybe that'll fix it.

Cheers -Terry

Edward K. Ream

unread,
Feb 29, 2008, 8:38:27 AM2/29/08
to leo-e...@googlegroups.com
On Thu, Feb 28, 2008 at 1:49 PM, Terry Brown <terry_...@yahoo.com> wrote:

Hmm, I just found this:

https://sourceforge.net/forum/message.php?msg_id=4078577

which suggests this:

import Tkinter
Tkinter.wantobjects = 0

which does seem to fix the problem.

Many thanks for this.  I'm a bit miffed that Tkinter has been broken this way, especially sinceLeo doesn't call any tcl methods directly.  The amount of breakage caused recently is troubling--it's worse than we've seen in all previous Python releases combined.

Anyway, it seems to me that probably only a few of Leo's core files should require the
Tkinter.wantobjects = 0 hack.  My guess is that only the leoTkinterX.py files, but I could be wrong.  Which files did you modify?

Well, the traceback on keystroke problem anyway, it's looking as if 8.5
breaks cleo somehow.

Troubling.
 
Too bad plumloco was abducted by aliens or whatever, gtk is probably
the long term solution to these issues.  Hope he's doing ok.

I certainly wish plumloco were back with us.  However, I have no idea about whether the gtk event loop will coexists with the IPython event loop.  I'd hate to lose the IPython bridge in the move to gtk.  It's a moot issue for now, alas :-)

Edward

Terry Brown

unread,
Feb 29, 2008, 9:41:28 AM2/29/08
to leo-e...@googlegroups.com
On Fri, 29 Feb 2008 07:38:27 -0600

"Edward K. Ream" <edre...@gmail.com> wrote:

> Anyway, it seems to me that probably only a few of Leo's core files
> should require the
> Tkinter.wantobjects = 0 hack. My guess is that only the

> leoTkinterX.pyfiles, but I could be wrong. Which files did you
> modify?

Um, ahem, well, I just stuck it at the beginning of leo.py, but if it
can be restricted to a few core files that would be great because...

> > Well, the traceback on keystroke problem anyway, it's looking as if
> > 8.5 breaks cleo somehow.

... cleo actually works fine with 8.5.1, until you enable the
wantobjects = 0 hack. Which I don't understand at all, I'd have
expected cleo to break in the same way as leo, not the reverse.

Cheers -Terry

Terry Brown

unread,
Feb 29, 2008, 10:08:32 AM2/29/08
to leo-e...@googlegroups.com
On Fri, 29 Feb 2008 08:41:28 -0600
Terry Brown <terry_...@yahoo.com> wrote:

> > > Well, the traceback on keystroke problem anyway, it's looking as
> > > if 8.5 breaks cleo somehow.
>
> ... cleo actually works fine with 8.5.1, until you enable the
> wantobjects = 0 hack.

Isolating the wantobjects = 0 hack in the leoTkinterX.py files gives
the same result as just doing it once at the start of leo.py. I.e. leo
works fine but cleo breaks. I intend to make cleo Tk free, relying on
only leos icon system for graphics, so I guess this problem will go
away, although not in a very satisfactory way.

Hmm, checking 8.4.x with wantobjects = 0, same thing, leo ok, cleo not.

Cheers -Terry

Edward K. Ream

unread,
Feb 29, 2008, 12:53:33 PM2/29/08
to leo-editor


On Feb 29, 9:08 am, Terry Brown <terry_n_br...@yahoo.com> wrote:

> Isolating the wantobjects = 0 hack in the leoTkinterX.py files gives
> the same result as just doing it once at the start of leo.py. I.e. leo
> works fine but cleo breaks. I intend to make cleo Tk free, relying on
> only leos icon system for graphics, so I guess this problem will go
> away, although not in a very satisfactory way.
>
> Hmm, checking 8.4.x with wantobjects = 0, same thing, leo ok, cleo not.

Leo's bzr trunk now contains the wantobjects = 0 hack. For now, I've
just put
the code at the start of leo.py. This is the "simplest thing that
could possibly work".

I won't test this on Linux until I figure out how to do a bzr
merge :-) Stay tuned...

Edward

Terry Brown

unread,
Mar 3, 2008, 6:02:56 PM3/3/08
to leo-e...@googlegroups.com
On Fri, 29 Feb 2008 09:53:33 -0800 (PST)

"Edward K. Ream" <edre...@gmail.com> wrote:

> Leo's bzr trunk now contains the wantobjects = 0 hack. For now, I've
> just put
> the code at the start of leo.py. This is the "simplest thing that
> could possibly work".

I wonder if it might be best to undo that. It's making leo work for
everyone running tkinter with Tk 8.5.1 (all two of us :-) but breaking
cleo for everyone else. As soon as I can I'll have an icon only Tk free
version of cleo for consideration.

Cheers -Terry

Edward K. Ream

unread,
Mar 4, 2008, 7:30:19 AM3/4/08
to leo-e...@googlegroups.com
On Mon, Mar 3, 2008 at 5:02 PM, Terry Brown <terry_...@yahoo.com> wrote:

On Fri, 29 Feb 2008 09:53:33 -0800 (PST)
"Edward K. Ream" <edre...@gmail.com> wrote:

> Leo's bzr trunk now contains the wantobjects = 0 hack.
 
I wonder if it might be best to undo that.

Done.  Revision 45 of the trunk.

Edward
Reply all
Reply to author
Forward
0 new messages