Unknown Tkinter bug

K

Krzysztof Szynter

Hi all

Like i said, i'am back. With another problem of course.
This is my code:

---BEGIN
win=Tkinter.Tk()
can=Tkinter.Canvas(win,width=500,height=500,background='blue')
can.pack()

# creating main lines
can.create_rectangle(10,10,490,490)
can.create_line(25,225,485,225)
can.create_line(250,470,250,20)
can.create_polygon((245,20),(250,10),(255,20))
can.create_polygon((475,230),(485,225),(475,220))
can.create_text(460,250,text='dV [m3]')
can.create_text(280,25,text='dU [J]')

# creating sublines
while x<450 or y<450 :
can.create_line((30+x,220),(30+x,225),(30+x,230))
can.create_line((245,25+y),(250,25+y),(255,25+y))
x=x+10
y=y+10

# starting drawing function image
for i in range(0,len(deV)):
can.create_oval(250+deV,250-deU,250+deV+1,
250-deU+1,width=3,outline='white')
for i in range(0,len(deV)-1):
can.create_line(250+deV,250-deU,250+deV[i+1],
250-deU[i+1],width=1,fill='yellow')

# creating etiquettes
can.create_text(250+200,210,text=int(maxdeV),fill='white')
can.create_text(250+10,250-200,text=int(maxdeU),fill='white',anchor='w')
can.create_text(250-200,240,text=int(mindeV),fill='white')
can.create_text(250-30,250+200,text=int(mindeU),fill='white',anchor='s')

win.mainloop()
---END

After i close graphcial window, shell gives this error message:

---BEGIN
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Program Files\Python232\lib\lib-tk\Tkinter.py",
line 1345, in __call__
return self.func(*args)
File "C:\Program Files\Python232\lib\idlelib\ScriptBinding.py",
line 157, in run_module_event
interp.runcode(code)
File "C:\Program Files\Python232\lib\idlelib\PyShell.py",
line 658, in runcode
self.interp.restart_subprocess()
AttributeError: ModifiedInterpreter instance has no attribute 'interp'
---END

Where should i look for a mistake?
 
K

klappnase

After i close graphcial window, shell gives this error message:

---BEGIN
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Program Files\Python232\lib\lib-tk\Tkinter.py",
line 1345, in __call__
return self.func(*args)
File "C:\Program Files\Python232\lib\idlelib\ScriptBinding.py",
line 157, in run_module_event
interp.runcode(code)
File "C:\Program Files\Python232\lib\idlelib\PyShell.py",
line 658, in runcode
self.interp.restart_subprocess()
AttributeError: ModifiedInterpreter instance has no attribute 'interp'
---END

Where should i look for a mistake?

Here's what I get when I run your example:

Traceback (most recent call last):
File "/usr/local/share/test.py", line 19, in ?
while x<450 or y<450 :
NameError: name 'x' is not defined

you actually use a couple of other variables that are not defined,
too,
so I think this is maybe not the complete code ?
Maybe you should have a look at the rest of the code if you have
problems.

BTW, the traceback you posted seems to look like an IDLE problem
rather than a Tkinter bug I think (at least PyShell.py is the main
file that runs IDLE's
Shell window).

Regards

Michael
 
K

Krzysztof Szynter

(e-mail address removed) (klappnase) wrote in
you actually use a couple of other variables that are not defined,
too, so I think this is maybe not the complete code ?
Yes.

Maybe you should have a look at the rest of the code if you have
problems.

This piece of code generates a bug.
BTW, the traceback you posted seems to look like an IDLE problem
rather than a Tkinter bug I think (at least PyShell.py is the main
file that runs IDLE's Shell window).

You were right. Restart the shell and the pc helped.
 

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

Forum statistics

Threads
474,264
Messages
2,571,336
Members
48,014
Latest member
saradhi

Latest Threads

Top