0
import turtle
import sys
from PyQt5.QtCore import*
from PyQt5.QtGui import*
from PyQt5.QtWebEngineWidgets import*

class TurtleControl(QWidget):
    def __init__(self,turtle):
        super(TurleControl.self).__init__()
        self.turtle=turtle

        self.left_btn=QPushButton("Left".self)
        self.right_btn=QPusButton("Right",self)
        self.move_btn=QPushButton("Move",self)
        self.distance_spin=QSpinBox()

        self.controlsLayout=QGriDlayout()
        self.controlsLayout=addWidget(self.left_btn,0,0)
        self.controlsLayout=addWidget(self.right_btn,0,1)
        self.controlsLayout=addWidget(self.distance_spin,1,0)
        self.controlsLayout=addWidget(self.move_btn,1,1)
        self.setLayout(self.controlsLayout)

        self.distance_spin.setRange(0,100)
        self.distance_spin.setSingleStep(5)
        self.distance_spin.setValue(20)

#set up turtle
window=turtle.Screen()
babbage=turtle.Turtle()

#Create  qt application

app=QApplication(sys.argv)
control_window=TurtleControl(babbage)
control_window.show()

#Enter QT application main loop
app.exec_()
sys.exit()

1 Answer 1

2

The error message looks clear to me: it's a typo

super(TurleControl.self).__init__()

should be

super(TurtleControl.self).__init__()

(Note the missing 't' in your code).

2
  • Thank you, I am modified and then try again again with other errors as follows:NameError: name 'QPusButton' is not defined
    – William
    Sep 18, 2019 at 0:46
  • That would be a new issue and you have to start a new question. It is not Pi related and Raspberry SE is actually not the right place to ask these questions. Make sure you give full code and full error messages
    – Dirk
    Sep 18, 2019 at 5:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.