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.
Any comment appreciated
It looks like you’ve provided the wrong GitLab link
Fixed. The forum seems to convert the link when we post.
the link still not work,
possibly as you have a private profile?
and you made us registering there?
can you just post
also a template name should be
and the user has to copy it to
Should be ok by now. I switched to gitlab recently sorry about this.
On p3 this would give the error
The file 'sketch.pyde' needs to be inside a sketch folder named 'sketch'. Create this folder, move the file and continue?
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 /
with ( minimal template )
size(640, 360) # Size should be the first statement
background(0) # Set the background to black
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.
that is no problem…
and if you refer to it not as a template , more like a library
it would be ok that most part of it is hidden,
but, if i want to work with the default PDE editor
and can not reach the file
to change the canvas X/Y,
we can not use it.
so, please could you make a version for us?
( flat structure, where the PDE sees all the files as TABs )
a good template should save lots of typing and give us a
default sketch / or frame work /
what shortens the way to our next own project.
if it is a template what works only for / with VSCode…
please state that in the topic title.
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.
See also: [TUTORIAL]Running Python Mode in VScode
Thanks @jeremydouglass, I edited my first post.