Being Creative With Turtles
Turtle is a module built into Python itself. The Turtle Class allows the user to directly adjust and interact with the Graphical User Interface (GUI). The Turtle module uses Classes to create Objects, if you’d like to learn more about Classes, Objects, Attributes and Methods before continuing please click here. To use the Turtle module, you must first import it, or you can get hold of the Turtle class directly by writing from the Turtle module import the Turtle class and then calling the Turtle class and tying it to an Object:
from turtle import Turtle
theo = Turtle()
print(theo)
#Result
<turtle.Turtle object at 0x000001CA43C714C0>
The Turtle module is capable of:
Creating a Screen:
Screen is another Class built into the Turtle module, its entire purpose is to present a visual representation of the Turtle Object that you have created with all attributes and any methods you chose to use with it. The Screen however will immediately close unless the method exitonclick() is used to preserve the screen until specifically told to close.
from turtle import Screen
my_screen = Screen()
my_screen.exitonclick()
Change the shape of you Object:
- Arrow
- Turtle
- Circle
- Square
- Triangle
Classic (which is an arrow)
from turtle import Turtle, Screen
my_screen = Screen()
theo = Turtle()
theo.shape(“turtle”)
my_screen.exitonclick()
Drawing:
You can think of the Turtle object as having a pen attached to its body and anywhere it goes it will draw a continuous line. An example of how to use the Turtles ability to draw is through an etch-a-sketch program you can find here.
Creation of an OOP Game:
Justin Tadros is a Project Manager and Data Analyst at The Training Boss. Justin has a bachelor's degree in Theater performance from Rollins College and currently pursuing his master's in business at the University of Center Florida. Justin is certified on Microsoft Power BI and Progress Sitefinity Sales accreditation with ongoing training on Python and CMS technologies. Justin performs in theaters in Orlando, Boston, Alaska and standup comic whenever the opportunity arises. His passion for performing and bringing incredible customer service to any industry he approaches is second to his commitment, dedication and hard work. |
Tags:
- AI (3)
- ASP.NET Core (3)
- Azure (13)
- Conference (2)
- Consulting (2)
- cookies (1)
- CreateStudio (5)
- creative (1)
- CRMs (4)
- Data Analytics (3)
- Databricks (1)
- Event (1)
- Fun (1)
- GenerativeAI (4)
- Github (1)
- Markup (1)
- Microsoft (13)
- Microsoft Fabric (2)
- NextJS (1)
- Proven Alliance (1)
- Python (6)
- Sales (5)
- Sitefinity (12)
- Snowflake (1)
- Social Networking (1)
- SQL (2)
- Teams (1)
- Training (2)
- Word Press (1)
- Znode (1)
Playlist for Sitefinity on YouTube
Playlist for Microsoft Fabric on YouTube
Playlist for AI on YouTube
Copyright © 2024 The Training Boss LLC
Developed with Sitefinity 15.1.8321 on ASP.NET 8