Hi,
Here’s an import modules template I’ve been working on to work with Processing using any outside code editor.
It allows users to launch the .pyde file with PDE, and simply clic the Play button to launch their sketch. Every real work on the .py files can be done elsewhere.
rename /template folder and template.pyde
add modules & classes in /obj
settings that need to be shared between classes are in the superclass settings.Settings
objects are loaded in the canva in lib.world.World.populateWorld. As long as the object as a setup() or draw() method, it will be created.
launch.py and template.pyde don’t need any change.
Please note that this has not been tested with controls inputs such as mousePressed.
yes, if you want to work on it, and want use sketch.pyde it must be under /sketch/sketch.pyde,
but i talked about use it as a template ( by using the PDE build in template system )
here run Processing 3.5.3 64bit / on win 10 64bit /
"""
sketch.pyde
"""
def setup():
size(640, 360) # Size should be the first statement
def draw():
background(0) # Set the background to black
def mousePressed():
works fine ( at any PDE start / switch to python mode , and at /file/new/ )
under what environment you tested that path ( for template ) i give you?
thanks, now i could download it.
you are aware that with PDE your files /lib/… can not be opened,
so here a flat structure is preferred
Maybe I’ve been misleading by using the word “template”, sorry.
I personnaly don’t like working in PDE, as it’s not a very good code editor next to, let’s say, VSCode. My solution’s purpose is to work in your prefered editor with a single instance of PDE opened next to your editor.
With this setup, you just load the .pyde file in PDE, and clic on the “Play” button when you want to launch your sketch.
I actually created this workflow because I have a lot of problems with PDE (it delete or rename files, don’t seem to reload modules, etc…). The PDE template system does not work for me, as you still have to edit code inside PDE for every new sketch, and I had problems while modifying a .py module in PDE and hiting save, the .py file was actually not really saved to disk.
I have not the time or the motivation to develop a workflow that will work with the convoluted ways of PDE when that’s exactly the opposite of what I want to do You can however load .py files that are stored inside a /lib subdirectory (use Sketch > Add Files or drag n drop in PDE)
My first post is definitly not clear enough about what I’m proposing and the terms I’m using, but I can’t seem to edit it (forum restriction?)
I’ll remove the /lib directory to comply on PDE way of saving files.
That is right – post editing locks after 5 days for new users. I’ve just bumped things up for you if you would like to make any edits to your original post – thanks for sharing your project with the forum.
I agree that clarifying that this is meant to provide a VSCode project setup – and/or that it is explicitly not for use with PDE – would help people understand when and how to use what you have created.