tcl/tk vs. python/Tkinter - Example attached

Daniel Kramer daniel at visionart.com
Wed Jun 14 13:20:47 EDT 2000


"richard_chamberlain" <richard_chamberlain at ntlworld.com> wrote in message
news:DCO15.563$fb5.9835 at news2-win.server.ntlworld.com...
> Hi Daniel,
>
> What platform are you working on?
>
> On my win98 machine I don't see any difference in speed (except python
> starts up very slightly slower).
>
> Other than that the readability of the python is the real clincher.
>
> Richard




Hmm.. interesting.  I also got a second response to my email stating
basically the same thing.  I am running on Win2k and I also tried it at work
on an SGI Octane.  I notice it less on the Octane but it still feels
different.

For me when I move a node around really fast it feels slightly choppy
compared to the tcl ver.. it's still responsive and it is a subtle
difference.  In the tcl ver the node is very fluid.. right there with you..
in tkinter there are these little laggy bumps in the motion... it stutters
slightly.

There is no question that the python code is much clearer.. your always
jumping though alot of hoops to get things formatted correctly in tcl I
find.  I was surprised that I liked coding TK more in python then tcl.

I'd like to do a benchmark but that would rely on doing a loop on the move
method and timing it rather then just "feeling" what it's like moving with
the mouse.. I just don't know if that would be an accurate benchmark since
it may only test the speed of the loop between the 2 languages and not the
tk move command itself.  I guess I could do the loop in both lang w/out the
move and with the move to isolate the move cmd timing.. hmm.

=Daniel



> Daniel Kramer <daniel at visionart.com> wrote in message
> news:3946B170.17A2630 at visionart.com...
> >
> > I have just started to use python this last week.. I wanted to port a
> > tcl/tk app to it and see how I like working with it.  As far as
> > programming with it I like it more.. but just as I got started on my app
> > I noticed some speed differences in TK.  The tcl/tk app is much more
> > responsive then the python/Tkinter app.
> >
> > I have put together a simple example done both ways.. it's attached to
> > this mail.
> >
> > Within the tar you will find:
> >
> > canvas.tcl - This is just a simple tcl/tk prog.. 2 rectangles are added
> > to a canvas and you can move them around with the mouse.
> >
> > canvas.py - This is the same thing written in python/Tkinter.
> > nodeUI.py - This contains most of the classes/functions to drive the
> > canvas.py.. it should be in the same dir as canvas.py
> >
> >
> > Since I am new to this lang I was just wondering if there was a way to
> > get better python/TK performance... if anyone could try out the examples
> > and let me know.. for me the tcl/tk one feels much more responsive but I
> > don't have any hard numbers to prove that.
> >
> > I have been reading that wxWindows is the much faster solution.. but I
> > am very familiar with TK and it's plenty fast for what I need.. but I
> > worry that the Tkinter ver won't be fast enough once I add alot more to
> > it.
> >
> >
> > -Daniel
> >
>





More information about the Python-list mailing list