Skip to main content

py5 mode plugin for Thonny

Project description

thonny-py5mode

A py5 plug-in for Thonny

Use the Thonny Python IDE as a Processing PDE alternative for creative coding. Thonny-py5mode is a plug-in that installs and configures Thonny for use with py5, a Python (3.8+) framework that leverages Processing's core libraries.

This plug-in will work with the portable version of Thonny. It's also likely to work with Thonny versions that include an installer.

Development on this package has just begun; thonny-py5mode is still in its experimental stages. It's only tested on Linux right now; it might work on Windows. You should be aware that there are a few py5 issues with Mac (OSX) computers.

Instructions

These are instructions for Linux. You'll need to adapt steps 1, 2, 3 for other platforms. Where applicable, there are notes for non-portable/installed versions of Thonny. You can skip straight to step 4 if you already have some version of Thonny that includes Python 3.8+ on your computer.

  1. Download the -alt version of the Thonny IDE (for Python 3.9 support) from: https://github.com/thonny/thonny/releases/tag/v3.3.7 (grab thonny-3.3.7-x86_64-alt.tar.gz for Linux)

  2. Extract this archive and place the thonny folder wherever you like on your computer (this runs as a portable app, no installer required).

  3. In the newly-extracted thonny folder, locate and run bin/thonny.

    If you're running Thonny for the first time, just accept the default Standard settings.

  4. Once Thonny is open, select Tools > Manage plugins...

    Then search for and install thonny-py5mode (note you'll need to restart Thonny after this step).

  5. When you've restarted Thonny, select py5 > Activate py5 mode for Thonny -- this will download and extract JDK-11 into the Thonny user-config directory (~/.config/Thonny on Linux). You'll have to activate this mode when you want to use py5 (but the download only happens on the first occasion).

    NOTE: Thonny will appear to freeze for a while when it's downloading JDK (the plug-in needs a proper progress indicator) --

    But, you'll be notified once the download is done.

  1. Try out an imported mode sketch using py5 > Run imported mode sketch (or using Ctrl+U).

    def setup():
        size(500, 500)
        fill(255, 0, 0)
        no_stroke()
    
    def draw():
    circle(mouse_x, mouse_y, 10)
    

    NOTE: you'll need to save your sketch (File > Save as...) somewhere first. After that, Thonny saves the file for you each time you run it.

Module Mode Sketches

You can run a py5 module mode sketch using the standard Thonny run menu (Run > Run current script). Be sure to py5 > Activate py5 mode for Thonny (this should be checked). As an example, you can try this code:

import py5

def setup():
    py5.size(200, 200)
    py5.rect_mode(py5.CENTER)

def draw():
    py5.square(py5.mouse_x, py5.mouse_y, 10)

py5.run_sketch()

Credits

I was inspired to get started on this by villares' experiment, and thonny-py5mode will likely end up integrated into this.

If you're interested in Python for creative coding and don't know about hx2A's py5 project, you need to check it out now!

Todo List

  • Get started
  • Add tickable/toggled menu option
  • Add support for non-portable/installed version of Thonny
  • Display download/installation progress in Thonny (not the terminal)
  • Add support for py5 imported mode
  • Fix portable mode
  • Auto-completion for module mode
  • Highlighting for py5 code
  • ...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thonny-py5mode-0.1.14a0.tar.gz (6.5 kB view hashes)

Uploaded Source

Built Distribution

thonny_py5mode-0.1.14a0-py3-none-any.whl (6.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page