- jjonesjths
- Posts: 8
- Joined: Thu Jan 02, 2020 7:31 pm
Turtle snowflakes
Hi,
I have followed code in the beginners guide book and doing Python and created a turtle snowflakes.
When I run the programme it does not draw a snowflake.
I don’t know how to upload the code to show you.
I have followed code in the beginners guide book and doing Python and created a turtle snowflakes.
When I run the programme it does not draw a snowflake.
I don’t know how to upload the code to show you.
Re: Turtle snowflakes
You can copy and paste that code here, then use the Code tags (either typed or from the menu above the reply box.)
app.php/help/bbcode
app.php/help/bbcode
- jjonesjths
- Posts: 8
- Joined: Thu Jan 02, 2020 7:31 pm
Re: Turtle snowflakes
Hi,
Image 1 is the first part of the code followed by Image 2
Image 3 is when I run the programme.
Please help
Image 1 is the first part of the code followed by Image 2
Image 3 is when I run the programme.
Please help
- Attachments
-
- 3884119A-29AB-4D53-9E5E-2CEE1169FA1F (1).JPG
- Image 3 when I run it
- 3884119A-29AB-4D53-9E5E-2CEE1169FA1F (1).JPG (98.54 KiB) Viewed 809 times
-
- 03F623D9-AC9A-4437-BEB6-7CB268435247 (1).JPG
- Image 2
- 03F623D9-AC9A-4437-BEB6-7CB268435247 (1).JPG (99.77 KiB) Viewed 809 times
-
- CC96028A-5FD9-40EF-A15A-1E552EA0C614 (1).JPG
- Image 1
- CC96028A-5FD9-40EF-A15A-1E552EA0C614 (1).JPG (98.56 KiB) Viewed 809 times
Re: Turtle snowflakes
As already requested, it is so much easier for volunteer helpers to recreate your problem and investigate if you post the code you are using.
A screenshot means laborious re-typing. I for one will not do that.
An alternative might be to post a link to the particular book, guide or tutorial you are following.
Beware of the Leopard
Re: Turtle snowflakes
My guess based on your partial code images, why is pat.color(...) commented out?
Re: Turtle snowflakes
There are snowflakes around in the net
https://github.com/MissPhilbin/GeekGurl ... owflake.py
and an explanation video too
https://www.youtube.com/watch?v=DHmeX7YTHBY
The code looks different from what OP posted. But it runs in Thonny and creates a certain pre-winter mood.
https://github.com/MissPhilbin/GeekGurl ... owflake.py
and an explanation video too
https://www.youtube.com/watch?v=DHmeX7YTHBY
The code looks different from what OP posted. But it runs in Thonny and creates a certain pre-winter mood.
Re: Turtle snowflakes
Un-indent lines 25-27, they are currently part of the function.
I'm assuming it should be the main program loop.
I'm assuming it should be the main program loop.
Re: Turtle snowflakes
A further response, added after a little research.
It seems likely that you are following a Project published by the Code Club, a part of the Raspberry Pi FOUNDATION which is an education and research organisation separate from the company which runs these forums.
Ref: Turtle snowflakes - https://projects.raspberrypi.org/en/pro ... snowflakes
If that is the case, can you confirm that you have successfully completed all the preceding intermediate steps in the project, including 'Creating Spiral Patterns'?
Because if you have written and run the earlier examples it should be fairly simple to spot which part of your most recent changes has caused the altered program to not work as you expect. Note that the project authors themselves stress this -
It seems likely that you are following a Project published by the Code Club, a part of the Raspberry Pi FOUNDATION which is an education and research organisation separate from the company which runs these forums.
Ref: Turtle snowflakes - https://projects.raspberrypi.org/en/pro ... snowflakes
If that is the case, can you confirm that you have successfully completed all the preceding intermediate steps in the project, including 'Creating Spiral Patterns'?
Because if you have written and run the earlier examples it should be fairly simple to spot which part of your most recent changes has caused the altered program to not work as you expect. Note that the project authors themselves stress this -
Note: Remember that indentation is important. Make sure to check that all your indentation is correct, otherwise your code won’t work!
Beware of the Leopard
Re: Turtle snowflakes
Actually, I think benisimmo is correct, this appears to be partial progress creating the snowflakes program.
I think the code should be:
Code: Select all
import turtle
import random
pat = turtle.Turtle()
turtle.Screen().bgcolor("grey")
colours = ["cyan", "purple", "white", "blue"]
pat.penup()
pat.forward(90)
pat.left(45)
pat.pendown()
def branch():
for i in range(3):
for i in range(3):
pat.forward(30)
pat.backward(30)
pat.right(45)
pat.left(90)
pat.backward(30)
pat.left(45)
pat.right(90)
pat.forward(90)
for i in range(8):
branch()
pat.left(45)
- Screenshot 2025年10月22日 at 12.58.51.png
- Screenshot 2025年10月22日 at 12.58.51.png (116.09 KiB) Viewed 721 times
- jjonesjths
- Posts: 8
- Joined: Thu Jan 02, 2020 7:31 pm
Re: Turtle snowflakes
The book I am referring to is;
https://www.amazon.co.uk/Official-Raspb ... 108&sr=8-1
A beginners guide to Raspberry Pi by Gareth Halfacree.
I will have a look at it tomorrow
https://www.amazon.co.uk/Official-Raspb ... 108&sr=8-1
A beginners guide to Raspberry Pi by Gareth Halfacree.
I will have a look at it tomorrow
Re: Turtle snowflakes
jjonesjths wrote: ↑Wed Oct 22, 2025 3:14 pmThe book I am referring to is;
https://www.amazon.co.uk/Official-Raspb ... 108&sr=8-1
A beginners guide to Raspberry Pi by Gareth Halfacree.
I will have a look at it tomorrow
On page #107, there is a section that says "Your finished program should look like this:"
I find it difficult to tell from your photos whether that is the case.
{Edit: added later - }
I can confirm that in my experiment the code published on that page ran as expected and produced a black snowflake on a grey background.
Last edited by B.Goode on Wed Oct 22, 2025 4:04 pm, edited 1 time in total.
Beware of the Leopard
- bjepstone
- Raspberry Pi Employee & Forum Moderator
Raspberry Pi Employee & Forum Moderator - Posts: 11
- Joined: Mon Mar 06, 2023 2:06 pm
Re: Turtle snowflakes
I've just added examples for each stage of the project to the book's GitHub repository at https://github.com/raspberrypipress/off ... s-guide-5e. You can download it using git from the Terminal or you can click the Code button and download a zip file.
If you download the zip, please extract it somewhere in your home directory. If you decide to use git clone in the Terminal, it will download the files into your home directory unless you use cd to change directory before you run git clone.
Assuming you've extracted the files to a folder called official-raspberry-pi-beginners-guide-5e in your home directory, you can click the Load icon in Thonny, navigate to the official-raspberry-pi-beginners-guide-5e/en/code/ch05 folder and you should see five files showing various stages of the project. Please open each one, confirm that it runs OK, and then you can compare those versions to yours.
bensimmo and rpiMike are correct that the final lines should not be indented under the branch() function. That's because they are the only place where the branch() function is called, so it would not be invoked unless those lines are part of the main program.
If you download the zip, please extract it somewhere in your home directory. If you decide to use git clone in the Terminal, it will download the files into your home directory unless you use cd to change directory before you run git clone.
Assuming you've extracted the files to a folder called official-raspberry-pi-beginners-guide-5e in your home directory, you can click the Load icon in Thonny, navigate to the official-raspberry-pi-beginners-guide-5e/en/code/ch05 folder and you should see five files showing various stages of the project. Please open each one, confirm that it runs OK, and then you can compare those versions to yours.
bensimmo and rpiMike are correct that the final lines should not be indented under the branch() function. That's because they are the only place where the branch() function is called, so it would not be invoked unless those lines are part of the main program.
- Attachments
-
- Screenshot 2025年10月22日 112541.png
- Screenshot 2025年10月22日 112541.png (33.87 KiB) Viewed 659 times
Jump to
- Community
- General discussion
- Announcements
- Other languages
- Deutsch
- Español
- Français
- Italiano
- Nederlands
- 日本語
- Polski
- Português
- Русский
- Türkçe
- User groups and events
- Raspberry Pi Official Magazine
- Using the Raspberry Pi
- Beginners
- Troubleshooting
- Advanced users
- Assistive technology and accessibility
- Education
- Picademy
- Teaching and learning resources
- Staffroom, classroom and projects
- Astro Pi
- Mathematica
- High Altitude Balloon
- Weather station
- Programming
- C/C++
- Java
- Python
- Scratch
- Other programming languages
- Windows 10 for IoT
- Wolfram Language
- Bare metal, Assembly language
- Graphics programming
- OpenGLES
- OpenVG
- OpenMAX
- General programming discussion
- Projects
- Networking and servers
- Automation, sensing and robotics
- Graphics, sound and multimedia
- Other projects
- Media centres
- Gaming
- AIY Projects
- Hardware and peripherals
- Camera board
- Compute Module
- Official Display
- HATs and other add-ons
- Device Tree
- Interfacing (DSI, CSI, I2C, etc.)
- Keyboard computers (400, 500, 500+)
- Raspberry Pi Pico
- General
- SDK
- MicroPython
- Other RP2040 boards
- Zephyr
- Rust
- AI Accelerator
- AI Camera - IMX500
- Hailo
- Software
- Raspberry Pi OS
- Raspberry Pi Connect
- Raspberry Pi Desktop for PC and Mac
- Beta testing
- Other
- Android
- Debian
- FreeBSD
- Gentoo
- Linux Kernel
- NetBSD
- openSUSE
- Plan 9
- Puppy
- Arch
- Pidora / Fedora
- RISCOS
- Ubuntu
- Ye Olde Pi Shoppe
- For sale
- Wanted
- Off topic
- Off topic discussion