As you know, programming has quickly become one of my favorite classes to teach. This year I’m reusing many of my materials from last year, so I actually have the time and mental space to fix things, change assignments, and tackle more intense projects. One of those projects is teaching the students some basic graphics with the Zelle textbook’s graphics.py package. Last year we just used Turtle, so this year I had to tinker around with Repl.it to get graphics.py to work.
As with everything in teaching (and ESPECIALLY in teaching programming), it took a few tries to get it right, so I’ll share my findings with you here:
1. Use Pygame in Repl.it
Though the graphics.py package from Zelle is built on Tkinter (old schoooollll), it actually won’t work if you choose the “Tkinter” Python option on Repl.it. It also won’t work if you choose “Python with Turtle.” Instead, you need to use the “Pygame” option.
Using this correct version, when students run their graphics visualizations their creations will appear in the top right of the screen.
2. Teach your students to “fork” your code
“Fork” is a funny name for it, but in programming this is just creating your own copy of someone else’s code. This can be a dangerous thing to teach students because it shows them just how easy it is to commit coding plagiarism, but because my students are beginners and I want them to focus on graphics and not the messy behind-the-scenes file usage, I created a template code for them (with Zelle’s graphics.py package already attached) which they then “forked.”
After they fork your code, make sure they share their Repl with you otherwise you’ll have to spend too much time searching for it.
And as you can see in the code in the first picture with all the #’s, I made it very clear to students which parts of the code they should edit and which parts they should leave alone. If one of your inquisitive students goes into graphics.py and edits things there to the point of “breaking it,” just have them start from square one!
If you’re an avid reader of my blog (thank you!), you may have noticed that here I’m using Repl.it with the kids, while earlier this year I was touting Colaboratory. Both are great, but I’ll be honest about why I chose to use Repl.it for this project – I don’t know how to import files (like graphics.py) in Colab and wasn’t ready to tackle that challenge. Hey, maybe that’ll be my update for this unit next year!
Proving Python is all fun and (py)games,