[Idle-dev] [Tutor] How to explore Tkinter interactively with IDLE 1.0

Gregor Lingl glingl at aon.at
Tue Oct 26 09:28:35 CEST 2004

Hi Pythonistas!

Today I'd like to ask a question, which at first may look a bit
technical, but which in fact for me is of high didactical importance.
It concerns the proper use of IDLE in Python 2.3.

With Python 2.2 (and IDLE 0.8) I used to use IDLE interactively
with my students to explore different features of Tkinter. I'll give
you two short examples:

1. Exploring Widgets:

 >>> root = Tk()
 >>> cv = Canvas(root, bg="white")
 >>> cv.pack()
 >>> btn = Button(root,text="Push")
 >>> btn.pack()
 >>> btn.config(bg="red")
 >>> # pushing the button doesn't do anything!
 >>> def action():

 >>> btn.config(command=action)
 >>> # pushing button creates red rectangle
 >>> cv.find_all()
 >>> cv.move(cv.find_all()[0], 100,150)
 >>> # rectangle moved , now create a new one
 >>> # or config existing widgets or canvasitems etc. etc.

Shortly, learn how Tkinter works

2. Using turtle-graphics

 >>> from turtle import *
 >>> forward(100)

A Canvas pops up and the turtle starts to move
and remains ready for the user to interact with
her interactively.

Alas! Both examples don't work in ordinary IDLE 1.0 - mode
I'm well aware of the advantages of IDLE 1.0, especially
the one always to have a  clean  workspace for testing 
programs - and I'd like to port as much of them to a
customized development environment I use in my classes.

Now, I'm considering to work with both of the two modes
in my classes, although I'm not sure, if this will be
easy to explain to my students.

How do you proceed to "keep it as simple as possible, but
not simpler?"

Are there other ways for developing Tkinter-GUI-programs
Specifically: can the turtle.module only be used
interactively (as intended) with the IDLE -n switch?

Although there are many other graphics modules around
I certainly will stick to using Tkinter (and IDLE),
because I consider it to be a big advantage for beginners to
start with tools as they come out of the box.

(Aside:  nevertheless I use to use IDLE with pythons -Qnew -
switch to avoid complications with division, i. e.
In my classes I silently import the future
- one of my means to minimize computer-hatred ;-)  )

Therefore I'm interested in every comment and every idea
on how to use the new IDLE optimally for educational purposes.

So I'll post this question (in contrast to my usual habit)
on tutor, edu-sig and idle-dev. This will remain an exception.


Gregor Lingl

P.S.: The new possibilities of printing the content of windows
and of customizing the appearance of IDLE (fonts, colors etc.)
easily e.g. for use with a beamer in a classroom is imho a big
advance. Especially when I try to convince my colleagues to use
Python, who, accustomed to the usual Windows, VisualBasic etc. comfort,
used to critisize the spartanic features of the old IDLE.
If you believe it or not, for many teachers (and students) those
things matter!

P.P.S: Moreover a gentle update of Dennies gentle introduction
to the use of IDLE would be a hit!

Tutor maillist  -  Tutor at python.org

More information about the IDLE-dev mailing list