[Edu-sig] Interactive Tkinter graphics under IDLE

Peter Drake drake at lclark.edu
Wed Feb 7 02:21:43 CET 2007


On Feb 6, 2007, at 4:20 PM, John Zelle wrote:

> You're right that on some platforms Tk windows will not "surface."  
> I haven't
> found a way around this problem yet. I don't understand what you  
> mean by the
> Console window. Aren't you using IDLE's shell?

Yes.

> In general the popping up behind problem is not a big deal since  
> you can just
> click on the appropriate icon on the task bar to bring it to the front
> (Windows and Linux). Although this may not work on the Mac...

Yes, there's a workaround, but it feels like one shouldn't have to  
work around it. We Mac users are spoiled that way.  :-)

>> 2) Once the main loop starts, you can't enter new commands into the
>> IDLE shell.
>
> I don't understand this comment. Are you running IDLE in it's  
> normal mode

Please disregard this comment. It's okay as long as you don't run  
mainloop().

>> 3) It is object-oriented, confusing students with the combination of
>> regularFunctions() and object.methods(). I'd just as soon avoid this
>> if possible.
>
> I can understand this if that's your goal. My point was to use  
> graphics as a
> very concrete way to introduce the idea of objects.  I don't find  
> that my
> students have any problems at all with using objects (writing their  
> own
> classes is another story).

I discovered last semester that (these) students find graphics VERY  
appealing, so I wanted to introduce that on day 1. I'd rather have  
them start off with

line([0, 0], [100, 100])

than

win = GraphWin()
myLine = Line(Point(0, 0), Point(100, 100))
myLine.draw(win)

>> If anyone can direct me to a way around the first two problems I
>> could, of course, write wrapper functions to deal with the third.
>
> Yes, it would be very easy to wrap flat functions around my  
> graphics library
> if you restrict yourself to one graphics window.

Working on it...

Thanks,

Peter Drake
Assistant Professor of Computer Science
Lewis & Clark College
http://www.lclark.edu/~drake/




More information about the Edu-sig mailing list