Random Musings of CS Teachers

How do we provide effective learning opportunities for our students to become creative problem solvers while they explore the world of Computer Science?

That is the million dollar question.

As we explore the science of learning and the associated classroom practices of teachers, let’s use this blog as a place to share ideas.

  • Teaching CS with Python? Time to try Thonny!!

    There are so many different Python editors available. As a Computer Science teacher you want an IDE (Integrated Development Environment) to be your student’s friend and aid in there understanding of “What’s really going on behind with my code?”. I use Eclipse with my senior students as they have previous experience, but a first IDE should be simple to use yet flexible to dig a bit to see the bits behind the code. Thonny fits the bill.

    I knew that Thonny was installed by default on Raspberry Pi distributions, but I never thought of trying it out on Windows. A recent discussion on our ACSE educator forum pointed me to dig deeper and I am impressed. Thonny is described as the Python editor for beginners, but if you turn on some of the view

    My current Python IDE in the classroom is the no charge version of Wing IDE. It has a debugger and decent user interface for novice coders. When we use Micro:bits or Pygame Zero we fire up Mu instead. Why Mu?

    • Using Mu with Micro:bits simplifies the transfer and flashing of .HEX files and the interactive plotting feature is very slick when you connect it to the accelerometer.
    • Using Mu with Pygame Zero has a nice simple location for images for your Actor objects (Sprites – graphics files) and a simple Play and Stop interface for testing.

    Let’s turn back to Thonny and take a look at a common scenario.

    Assistant window in Thonny

    Who encounters these types of syntax errors? Everyone!!

    The Python Shell spits out a SyntaxError and points to line 9. The Thonny assistant says he you probably have unbalance parentheses, brackets or braces in line 8. Which message is better? Very cool!

    The debugger is awesome as it slowly expands the source code to demonstrate what is happening step by step.

    It has already executed the lower() method on the left side of the expression

    You can easily add new packages by clicking on tools. I added pygame zero and others with no problems.

    package manager built-in

    I also found a feature that let’s you toggle to pgzero mode which worked perfectly.

    Pygame Zero mode to launch Graphical window

    Did I also mention that when you download Thonny and install it the Python 3.7 environment is included?

    I think I have found my next IDE for novice Python coders. The debugger is like having a Python visualizer built in and the assistant can really help students find their errors and learn from them.

    Just to add a final “wow factor” – turn on the plotter option and write a small Python program and ask your students to explain why the maximum value of y is 2 ?