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.

Instructions

If you already have some version of Thonny that includes Python 3.8+ on your computer, you can skip straight to step 4.

  1. Download and install the Thonny 3.3.7 -alt version of the Thonny IDE (for Python 3.9 support) from github.com/thonny/thonny/releases/tag/v3.3.7:

    The Thonny 4 IDE (currently in beta) ships with Python 3.10. The thonny-py5mode plug-in should run fine on Thonny 4 for Linux; it should also work with macOS and Windows. Expanding the Assets for any release will reveal the downloads for Windows/macOS/Linux --

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

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

    Then search for and install the thonny-py5mode plug-in --

    You must restart Thonny after this step.

  4. When you've restarted Thonny, select py5 > Imported mode for py5 --

Click Proceed to download, extract, and set up JDK-17 (if you need to know: the plug-in installs JDK in the Thonny user-config directory). Thonny only needs to download JDK the first time you switch to imported mode.

You'll be notified once this process completes --

  1. This step is optional. There are several Thonny settings that I recommend you apply for working with py5 (including a Processing 4 inspired theme, Kyanite). You can apply those settings in one simple step using py5 > Apply recommended py5 settings

  2. When the py5 Imported mode for py5 option is checked, Thonny can run your py5 code --

    Test out an imported mode sketch by clicking the green play button (or using the F5 or Ctrl+R keyboard shortcuts). Here is some code:

    def setup():
        size(300, 200)
        rect_mode(CENTER)
    
    def draw():
        rect(mouse_x, mouse_y, 10, 10)
    

    NOTE: This mode also runs static mode sketches (when you don't need a draw() function for animation).

    Click the stop-sign (🛑) button in the Thonny toolbar to stop your sketch.

Module Mode Sketches

To run a py5 module mode sketch, deactivate/uncheck py5 > Imported mode for py5 first so that Thonny returns to its normal run behaviour (for running any Python script). As an example, you can try this code:

import py5

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

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

py5.run_sketch()

Note that module mode requires an import py5 and run_sketch() line, and py5. prefixes.

Useful py5 resources

py5 is a new version of Processing for Python 3.8+. It makes the Java Processing jars available to the CPython interpreter using JPype. It can do just about everything Processing can do, except with Python instead of Java code. Here are some useful py5 resources (alphabetically listed) --

Credits

Thanks villares for inspiring me to develop this plug-in, hx2A for the awesome py5 project, and the Thonny folks for their fantastic IDE.

Todo List

See discussions on GitHub repo. This plug-in is a work in progress ... please report issues here.

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.4.3a0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

thonny_py5mode-0.4.3a0-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file thonny-py5mode-0.4.3a0.tar.gz.

File metadata

  • Download URL: thonny-py5mode-0.4.3a0.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for thonny-py5mode-0.4.3a0.tar.gz
Algorithm Hash digest
SHA256 dd7da04cabc41be2d65f5a331071a280bf938a9e373c388858381dba97b56114
MD5 64a1c20ae96df46de07a597f14276c5b
BLAKE2b-256 2cd5ad64e5443daa8ca06eb4520c2da023381c21d519321570c90f8e67e56697

See more details on using hashes here.

File details

Details for the file thonny_py5mode-0.4.3a0-py3-none-any.whl.

File metadata

  • Download URL: thonny_py5mode-0.4.3a0-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for thonny_py5mode-0.4.3a0-py3-none-any.whl
Algorithm Hash digest
SHA256 55591ce0f305e4e8558acecea0c82284cf5dc017f548ccc58211a474358d3f0a
MD5 ab6a2ad4c7a649e683555f16a8298ab1
BLAKE2b-256 11924210619a24b3b84087bdf8d04b6f74ad6eee35c6d208e9bd5b75937ce599

See more details on using hashes here.

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