Python Adventures

I have been working on developing a simple online IDE for Python aimed at beginners and geared towards the creation of text-based adventures. There are already many online IDEs which support Python and I’m not trying to replace them as my tool is very simple in comparison. I have focused on creating user interface that is friendly and engaging for new programmers.

Another aim I set out to achieve was to write custom modules that could be built into the environment which would expand the fun and creative things that can be achieved with Python without the installation of additional libraries.

The resulting tool is called Python Adventures and can be found at pythonadventures.co.uk.

Python Adventures is based on the Skulpt browser based implementation of Python which is already employed by trinket.io. It is very much a work in progress, however it is free for you to use at your own risk. In the following section I will provide an introduction to the environment and give an overview of its features.

At the top of the page there are buttons which enable the user to load, save and export projects in addition to options which enable the interface to be customised to individual needs. There are three options for text size, and high and low contrast colour schemes.

Screenshot of Python Adventures header.

The main page is split into three sections, these are detailed below:

Code Panel

The Code panel features the code editor and also an option to show the instructions for the activity (if any). Clicking the i button at the right hand side of the code panel header will show the instructions.

Screenshot of the code panel.

Output Panel

The Output panel features two sections: text input/output and a canvas for Turtle based projects. When the input function is called with a program, a text box will appear in the text window. When the user presses enter, the box will disappear and the user’s input will appear in its place. The program can be run by pressing the play icon.

Screenshot of the output panel.

The program can also be run using the R access key, for example:

  • Chrome and Edge on Windows: Alt + R
  • Firefox on Windows: Alt + Shift + R
  • Firefox and Chrome on Mac: Control + Option + R
  • Firefox and Chrome on Linux: Alt + Shift + R

Function Calls Panel

The Function Calls panel enables users to test individual functions from their program at any time. Once the user has called a function once, a button appears in the panel which will call the function whenever it is pressed. The aim of this is to encourage learners to start using and testing functions early on.

Screenshot of the Function Calls panel.

Functions can also be called using the C access key, for example:

  • Chrome and Edge on Windows: Alt + C
  • Firefox on Windows: Alt + Shift + C
  • Firefox and Chrome on Mac: Control + Option + C
  • Firefox and Chrome on Linux: Alt + Shift + C

Saving and Exporting

Clicking on the Save button will download the program as .py file. Whereas, clicking on the Export button will export the current state of the code and instructions as an HTML file. The resulting HTML file will run locally, although internet access is required as the page needs to call on scripts and style sheets hosted at pythonadventures.co.uk. You could use this facility to prepare a starter program with instructions which could be shared with your students.

Bitmap Module

I have also incorporated the custom bitmap module. This enables users to define and display bitmap graphics utilising the turtle library.

import bitmap as b
pattern = "2,111111:102201:123321:123321:102201:111111"
img = b.Bitmap(image=pattern)
img.draw()

The example program shown above defines a displays a simple 2 bit image. The resulting image is shown in the screenshot below:

Example bitmap generated by bitmap module.

I will give further details of the bitmap module in an upcoming blog post.

Leave a Reply

Your email address will not be published. Required fields are marked *