You may wonder, “How do I use Python on Chromebooks?” There are many web-based apps, but most work if the program contains only Python code. They tend to limit the use of many Python libraries.
However, if you are teaching young programmers then the Turtle Library is important. The Turtle module can be used to create artwork and design games. It requires a graphic interface that will display output on a canvas. One web-based option is Trinket.
What Is Trinket?
Trinket is web-based coding environment designed for education. The platform can be used to develop programs using Python, HTML, and Java. Subscribers can save their files called “trinkets” online. Non-subscribers can still use the Trinket platform to write code. However, at the end of a programming session, they must download the program to save it. Later, the file can be uploaded to continue editing the code.
Trinket Is Ideal for Young Programmers
The programming lessons in TechnoTurtle published by TechnoKids Inc. were written for IDLE Python 3. IDLE is Python’s Integrated Development and Learning Environment. This software includes a Python text editor, Python Shell that interprets code, plus a graphic interface that displays a canvas. IDLE Python 3 will run on Windows, Linux/Unix, and Mac OS X operating systems.
The latest version of IDLE Python makes programming easier for children to learn. At this time, there is not a web-based IDLE Python version for Chromebook users. For this reason, Trinket is a great web-based coding option for educators interested in introducing Python to young children.
How Can I Use the TechnoTurtle STEM Project with Trinket?
If you are using the TechnoKids Inc. STEM project TechnoTurtle, follow the instructions below to get started with Trinket. You will use the Pygame option to build programs. Refer to the tips at the bottom of this article to help teach TechnoTurtle.
How Do I Use Python on Chromebooks?
You may be wondering, how do I use Python on Chromebooks? One solution is to use Trinket.
-
- Visit trinket.
- If you are using Chromebooks with your students they will all have a Google account. Look around the Home page to find the Sign in with Google option.
- Once signed in, click your username to display a menu.
- Select New Trinket and then pick Pygame.
-
- Write the code in the left pane. Click Run to see the result in the right pane.
- If necessary, click Stop.
- If your students cannot complete their program (and they are not subscribers), they can copy the text to Google Doc file for safekeeping. Another option is to download the file. To do this click on the three lines. From the menu, select Download. Give the file a suitable name and then click Save. The file will be zipped. You will need to unzip the file to access the Python.py program.
- To continue working on the file, you can paste the text onto the Main tab or Upload the text file (see tip below).
Tips to Using TechnoTurtle with Trinket
If you purchased TechnoTurtle and you use Chromebooks, you may wonder, “How do I Use Python with TechnoTurtle on Chromebooks?” A few of the instructions in TechnoTurtle will require modification when using Trinket instead of IDLE Python. However, almost every lesson will work perfectly. Below are some tips to using TechnoTurtle with Trinket:
-
- Stop the Canvas from Becoming Blank: After you run a program in Trinket the canvas can appear empty. To be able to see your work, add exitonclick() to the last line of the program. This will keep the image or game in view.
-
- Upload Background or Stamp Images: Picture files can be used as a background or turtle shape. When using IDLE Python, the Python.py file and picture files must be in the same folder. When teaching using Trinket, you must upload the file using View and Add Images. You must then select the file and click Done to attach it to the program.
Upload picture files to use them as background images or Turtle shapes.
- Upload Background or Stamp Images: Picture files can be used as a background or turtle shape. When using IDLE Python, the Python.py file and picture files must be in the same folder. When teaching using Trinket, you must upload the file using View and Add Images. You must then select the file and click Done to attach it to the program.
-
- Get to Know the Trinket Canvas Size: The Trinket canvas is smaller than the IDLE Python canvas. The Trinket canvas is about 350 pixels wide by 400 pixels high. Whereas the IDLE Python canvas by default is about 600 pixels wide by 600 pixels high. To view your work easily you may need to reduce the values used for the coordinates. For example, use goto(-175, 200) to reach the top left edge; goto(175, 200) to reach the top right edge; goto(175, -200) to reach the bottom right edge; and goto(-175, -200) to reach the bottom left edge.
-
- Use the Trinket Resources: TechnoKids has recreated the Python templates, Python examples, and images to fit the Trinket canvas. They are in a Trinket folder. Use them instead.
-
- Picture Files Used for Stamps Need to Be Small: Since the Trinket canvas is smaller, if you want to add a picture file to the Turtle shape list the image should be a maximum of 50 x 50. This looks better when adding multiple stamps.
-
- Keep Movement Below 375 Steps: To keep the Turtle on the screen it is a good idea to limit forward and backward commands below 375. For example forward(450) will move the turtle symbol out of view.
-
- Divide the Values in TechnoTurtle by Half: Almost every assignment in TechnoTurtle will work with Trinket with no modification. A few of the activities do provide sample coordinates or movements. These might be too large to see on the canvas. In those cases, take each number and cut it in half. If the value is forward(200) make it forward(100). This will quickly make the sample scripts work.
-
- Reduce the Font Size to Fit Text on the Canvas: Given that the Trinket canvas is smaller than the IDLE Python canvas, you will want to use font size 12 or less. This will allow you to fit more words on the screen. For example, write(“Add a message to the canvas.”, font=(“Arial”, 12, bold))
-
- Have Patience With Input Boxes: If you want to store a player’s answer as a variable you must be patient when playing the game. It takes time for the cursor to show in the box.
-
- Upload a Template or Saved File: Subscribers can easily save or open Python files. However, non-subscribers cannot. If you are not quite sure if you want to commit to a Trinket subscription just yet, you might need to copy the code to the Main tab to run it.
-
- Do Not Set the Canvas Window Title: In IDLE Python, programmers can customize the title bar. This looks great on a large screen. However, in Trinket the frame around the window is very tiny. Do not bother using the code title(“Text in the title bar”). It does not generate an error, but you also cannot see anything.
-
- Notice that Color-Coding is Different: Words in a program are often color-coded. This makes the code easier to read, write, and debug. The color scheme in Trinket is different than IDLE Python. For example, comments are green instead of red.
-
- Speed Differences are Not as Noticeable: The speed of the turtle can be set to slowest, slow, normal, fast, and fastest. The difference between the speeds often cannot be seen in Trinket. For this reason, it is best to use either speed(“slowest”) or speed(“fastest”).
-
- Line Number Errors are Not Clickable: In the IDLE Python Shell, error messages with line numbers are clickable. This takes you right away to the problem in the code. Trinket’s error messages do not have clickable links. Instead, programmers must read the line number in the error message and then find it in the code.
- Use the Chrome Web Browser: If you are using a Chromebook, you are using the Chrome web browser. However, for anyone using Trinket on a different device, be certain to use Chrome. Trinket will work better. The screen tends to scale larger and there is less hesitation when running the code.