Create with code
Write, run, debug and share python code with online python editor is now open source! is an online python editor that allows you to write, run, debug and share python code in your web browser. It launched in April 2016 to help students learn to write code on any device without having to install any specialist software.

In June 2016 I added a BBC microbit simulator to make it easier for my students to write, debug and share python code for a BBC micro:bit. Since then, I’ve been approached by a number of different people to see if they can adapt or extend some of the features on this site. All of the resources on this site are published under the Creative Commons share-alike license which means you’re free to use anything here for whatever purpose as long as you reference me as the original author. Up until now though, whilst has been free to use, the source code that makes it work hasn’t been openly available. I’m really grateful to those of you who have got in touch to request a feature or report a bug but I’ve been really impressed with the response to the site from people who have ideas of how to make it even better.

I’m pleased to announce that is now open-source. This means that if you can think of a way to improve the python editor or you spot a bug that needs fixing, you don’t have to wait for me to code it: you can jump right in and adapt / extend / improve it however you like. You’re free to use it for your own projects – I’d love to hear from you if you find a use for it.

You can find the source code for here.

If I had the time, I’d love to extend or adapt for the following:

  • self marking python tests that integrate with moodle
  • create 3d games and objects using python
  • interactive competitive python quizzes that integrate with moodle

The possibilities are endless (but time is very limited!) so hopefully going open source will allow someone to get creative and innovative without me holding them back!



This Post Has 8 Comments

  1. Gareth Joseph

    Hello, really enjoying the simulator and I’m using it to teach with but every time I try to simulate an input the simulator crashes. The coding seems correct because when I download the HEX file to a microbit it works. I’m assuming that I’m doing something wrong? Cheers Gareth

    1. pddring

      Hello. Could you post a link to your code? I suspect that there’s a while True loop there that keeps looping round, which will cause your browser to crash.

      The way round it will be to add a sleep(10) command into your loop to pause the CPU for 10ms (or however long you want) so that the processor isn’t working all of the time.

      The microbit will work without this (although it might heat up and use more battery life), but the browser will try to simulate the while loop in real time, making it go unresponsive (crash). You’ve not done anything wrong – you’ve discovered a good teaching opportunity about the risk of getting stuck in forever loops and processor utilisation!

      Here’s an example:

      1. Gareth Joseph


        Here’s one example.

        Thanks Gareth

        from microbit import*
        import random
        paper = Image(“99999:90009:90009:90009:99999 “)
        rock = Image(“00000:09990:09990:09990:00000”)
        scissors = Image(“90099:09099:00900:09099:90099”)

        ropasc = [paper, rock, scissors]

        while True:
        if accelerometer.was_gesture(“shake”):

        1. pddring

          Nice program.

          Here’s a link with it working in the simulator:

          You need to add a sleep() function inside the while loop, otherwise the CPU is working at 100%.
          It’ll work without the sleep() function on the microbit but use more power than necessary. It’ll crash the browser if you run the simulator without the sleep() function.

          Hope that helps 🙂

        2. Gareth Joseph

          Tried that, it works! Can you please explain to me why the loop crashed the browser when the accelerometer hadn’t been triggered the first time. Thanks, my lessons and SOW are saved.

          1. pddring

            I’ve just released an update for which means infinite loops no longer crash the browser. It’s been something I’ve been wanting to sort out for a while – thanks for prompting me to finally find out how to do it!

            Before, the loop would repeat continuously, using up all the CPU resources and causing the browser to crash. Now, the python simulator detects if too many lines of code are running per second and slows it down a little so that the browser has a chance to keep up with all the other background tasks it needs to do.

  2. Gareth

    Thanks, I’m very grateful. Still surprised that BBC didn’t think about this. Sadly in the school I’m in we use thin clients and the ICT technicians don’t know how to map the USB ports so we cant actually program the microbits! Right now I’m trying to understand the code for tetris- and struggling.

    1. pddring

      That’s a shame about the thin clients. Hopefully the simulator means students can see the code working then could you get one laptop with USB drive set up for them to test it when they’ve finished a project? I’ve not seen Tetris working-do you have any code for it?

Leave a Reply