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.
-
Download and install the -alt version of the Thonny IDE (for Python 3.9 support) from: https://github.com/thonny/thonny/releases/tag/v3.3.7
-
Start Thonny. If you're running it for the first time, just accept the Standard settings.
-
Once Thonny is open, select Tools > Manage plugins...
Then search for and install thonny-py5mode plug-in --
You must restart Thonny after this step.
-
When you've restarted Thonny, select py5 > Imported mode for py5 -- this will download, extract, and set up JDK-11 for you (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.
NOTE: Thonny will appear to freeze for a while when it's downloading JDK (I have plans to develop a proper progress indicator later).
You'll be notified once the download is done --
-
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
-
When the py5 Imported mode for py5 option is checked, Thonny will run your code using py5 --
Try out an imported mode sketch using the green play button (or the F5 or Ctrl+R keyboard shortcuts).
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).
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(200, 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 for everything.
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
This plug-in is still very much a work in progress ... please report issues here.
Integrate alpha version py5 (and JDK) installer- Display download/installation progress in Thonny (not the terminal) -- so Thonny doesn't appear frozen while when it's downloading JDK
- Restorable Thonny settings -- restore applied py5 config (themes, etc.) on deactivate
Support for non-portable/installed Thonny- Support for portable Thonny?
Imported mode auto-completionProcessing inspired theme for UIProcessing inspired theme for syntaxImported mode Syntax highlightingPop up built-in save dialog for new unsaved filesUpdate instructions/readme- Conceal full run_sketch.py run command in Thonny shell?
- Add Processing.py mode (using py5_tools > translators)?
- ...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file thonny-py5mode-0.2.4a0.tar.gz
.
File metadata
- Download URL: thonny-py5mode-0.2.4a0.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c98a389ce66d2d495cf77fdc6430498785386a8fab84864bff78036bb8f4a7e4 |
|
MD5 | 8fd777d3b0a444b126da85111af81098 |
|
BLAKE2b-256 | 7bb79612d649950e86258f1da4402ff868b971aa33c5a1863c94f184a335dfce |
File details
Details for the file thonny_py5mode-0.2.4a0-py3-none-any.whl
.
File metadata
- Download URL: thonny_py5mode-0.2.4a0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11f3c0156ef8d1ad2bced876218aa356cb4291ce15f545d1264e471b9fd6e1e1 |
|
MD5 | c6b352eddeaa862dbc69bbd6623b3760 |
|
BLAKE2b-256 | 4bb3c3ec01a4743e241766b5042dba5af150259d646c088756e241c95dcf1c63 |