V
V
VB20072020-06-29 16:23:16
Python
VB2007, 2020-06-29 16:23:16

Why does Python 3.4.4 throw a "raise Terminator" error when using the turtle module?

I am writing a light "Rice" with a turtle, for some reason the error "raise Terminator" began to be displayed The
full text of the error:

Traceback (most recent call last):
File "C:\*полный путь я убрал))\*название файла я тоже убрал.py", line 2, in <module>
    t=turtle.Turtle()
  File "C:\Python34\lib\turtle.py", line 3816, in __init__
    visible=visible)
  File "C:\Python34\lib\turtle.py", line 2557, in __init__
    self._update()
  File "C:\Python34\lib\turtle.py", line 2660, in _update
    self._update_data()
  File "C:\Python34\lib\turtle.py", line 2646, in _update_data
    self.screen._incrementudc()
  File "C:\Python34\lib\turtle.py", line 1292, in _incrementudc
    raise Terminator
turtle.Terminator

Personally, I have no idea what is happening here at all, judging by the text of the error, it is possible that the error is in the turtle code (turtle.py), but it seems to me that I am messing up somewhere. Help please))
Here is the code of the program:
import turtle, msvcrt, sys, time
t=turtle.Turtle()
from tkinter import *
helper=Tk()
c=Button(helper,
         text='Clear',
         bg='white', fg='black')
c.bind('<Button-1>', t.clear())
c.grid(row = 3, column = 1, columnspan = 3)
q=Button(helper,
         text='Exit',
         bg='grey', fg='red')
q.bind('<Button-1>', sys.exit)
q.grid(row = 2, column = 1)
up=Button(helper,
         text='Up',
         bg='light grey', fg='black')
up.bind('<Button-1>', t.up())
up.grid(row = 1, column = 3)
D=Button(helper,
         text='Down',
         bg='light grey', fg='black')
D.bind('<Button-1>', t.down())
D.grid(row = 2, column = 3)
helper.mainloop()
trn=5
run=5
while True:
  pressedKey = msvcrt.getch()
  if str(pressedKey) == "b'q'":
    sys.exit()
  elif str(pressedKey) == "b'w'":
    t.forward(run)
    time.sleep(0.01)
  elif str(pressedKey) == "b'a'":
    t.left(trn)
    time.sleep(0.01)
  elif str(pressedKey) == "b's'":
    t.backward(run)
    time.sleep(0.01)
  elif str(pressedKey) == "b'd'":
    t.right(trn)
    time.sleep(0.01)
  elif str(pressedKey) == "b'c'":
    t.clear()
  elif str(pressedKey) == "b't'":
    try:
      eval(input('''Enter code:
'''))
    except SyntaxError or ValueError or NameError or ZeroDivisionError or MemoryError or IndexError:
      print ('Error')
  elif str(pressedKey) == "b'u'":
    t.up()
  elif str(pressedKey) == "b'j'":
    t.down()
  elif str(pressedKey) == "b'W'":
    t.forward(run*2)
    time.sleep(0.01)
  elif str(pressedKey) == "b'A'":
    t.left(trn*2)
    time.sleep(0.01)
  elif str(pressedKey) == "b'S'":
    t.backward(run*2)
    time.sleep(0.01)
  elif str(pressedKey) == "b'D'":
    t.right(trn*2)
    time.sleep(0.01)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question