Tk windows in w2k IDLE don't close

M

Matthew Wilson

Hi -

I wrote this program:

import Tkinter

root = Tkinter.Tk()
root.title('tkfun is tktastic!')
cc = Tkinter.Canvas(root, width=400, height=400, bg="white")

for x in range(0,400,20):
color = "#%x%x%x" % (x*12,x*12,x*12)
rect = (x,x,x+20,x+20)
cc.create_rectangle(rect, fill=color)

cc.pack()
root.mainloop()

I write all that in an idle window and then hit f5 to run it. The window
pops up ok, but after I close it, I still don't get my python interactive
session back. If I try to close that window, I get a message saying the
program is still running. What am I doing wrong?

Thanks in advance.
 
V

vincent wehren

| Hi -
|
| I wrote this program:
|
| import Tkinter
|
| root = Tkinter.Tk()
| root.title('tkfun is tktastic!')
| cc = Tkinter.Canvas(root, width=400, height=400, bg="white")
|
| for x in range(0,400,20):
| color = "#%x%x%x" % (x*12,x*12,x*12)
| rect = (x,x,x+20,x+20)
| cc.create_rectangle(rect, fill=color)
|
| cc.pack()
| root.mainloop()
|
| I write all that in an idle window and then hit f5 to run it. The window
| pops up ok, but after I close it, I still don't get my python interactive
| session back. If I try to close that window, I get a message saying the
| program is still running. What am I doing wrong?

Try uncommenting "root.mainloop()" as long as your testing/developing in
IDLE.

HTH
Vincent Wehren

|
| Thanks in advance.
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top