Here are resources for installing Python:
Getting Started With Turtle
Getting Started with
turtle. Pre-requisites. As
turtle is built into Python, there are only a couple of things that you’ll need. Firstly, Python. This may seem somewhat obvious, but you’ll need Python 3 installed on your computer to follow along.
00:17 This will need to be on a computer with a graphical user interface, such as Windows, macOS, or a desktop version of Linux. Put simply, if you use a mouse to control your computer, you should be okay.
00:43 Python Environment. For much of this course, you’ll see the Python REPL being used. This allows entry of Python commands and their instant execution. For the final project, the code will be written in an editor as this code is longer and more complex than any of the previous examples, and it will be built up in stages.
In my case, I’ll be using Visual Studio Code, but you can use any editor such as IDLE, which is installed alongside Python. And that’s it! You’re ready to start using Python
turtle, so let’s head into the next section and see it in action.
turtle On Screen. Here, you will see how to move towards using
turtle. The terminal command prompt is what’s needed to run the Python REPL, so we’ll just take a quick look at how to launch on macOS, Linux, and Windows.
01:51 On Ubuntu Linux, tap the Windows or Command key depending on the hardware you’re running on, and then type “terminal”. Once again, when it’s the highlighted choice, you can launch it using Enter.
Import and Naming Conventions. The Python documentation example imports
turtle using this command:
from turtle import *. This has good and bad points, but I wouldn’t recommend it for a beginner, simply because then it’s not easy to tell if a command is a built-in Python command or if it’s part of the
turtle library. Instead, make use of
import turtle as previously seen.
04:03 The other commands used for controlling the turtle will also work in the same way, but this can mean a lot more typing and it’s much easier to assign a variable name to them, a bit like naming a pet, as then you know you are always referring to the correct object.
04:19 Whenever you choose a variable name, try to balance making it meaningful with keeping it succinct. When you come back to your code in a few weeks time, it makes reading the code so much easier if the variable names make sense.
Initially, you will see
s used to refer to the screen and
t to refer to a turtle. With that out of the way, let’s look at programming Python
turtle, exploring the features and functions that are present.
Become a Member to join the conversation.