Closed hx2A closed 2 years ago
Seems like an odd scenario -- like, why bother with setup()
at all? Then again, Processing.py will resort to static mode behavior -- so your dummy draw proposal replicates that :+1:
A bit of context: pyp5js wasn't working "in static mode" so I got into the habit of making students work static sketches in setup()
Now, pedagogically, I find it useful to make students work in setup(), makes the transition to setup/draw easier.
On Thu, 23 Jun 2022, 06:38 tabreturn, @.***> wrote:
Seems like an odd scenario -- like, why bother with setup() at all? Then again, Processing.py will resort to static mode behavior -- so your dummy draw proposal replicates that 👍
— Reply to this email directly, view it on GitHub https://github.com/py5coding/py5generator/issues/89#issuecomment-1164182465, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4GADATLVSHX2NN5LV7CWTVQQV73ANCNFSM5ZNX75ZQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Seems like an odd scenario -- like, why bother with
setup()
at all? Then again, Processing.py will resort to static mode behavior -- so your dummy draw proposal replicates that 👍
Right, it is an odd scenario, but it should still work in that situation. I don't think it will be a hard fix.
Now, pedagogically, I find it useful to make students work in setup(), makes the transition to setup/draw easier.
What if they don't know about functions yet?
What if they don't know about functions yet?
Yep, that's a challenge. Some noise they are putting up with! "Trust me, put your code indented into this setup() block here and py5 will call this for you. I'll explain this def thing later." It might indeed be a bad idea, I'm not sure. I had to use it with pyp5js and rationalized it probably.
I noticed I use it in my own static sketches too. It lets me put the helper functions down the listing.
Yep, that's a challenge. Some noise they are putting up with!
Maybe consider using py5bot to help with that! Here's a notebook I used to do just that in a intro presentation two weeks ago:
When I put this in Thonny and run it:
def setup():
size(400, 400, P2D)
rect(10, 10, 20, 20)
the window stays open, as it should. This bug only affects Sketches that use the default renderer.
Also, this bug is related to #82. A proper fix for #82 will fix this bug as well. Any fix for this issue that does not also fix #82 is a hack.
I fixed two seemingly unrelated bugs by removing one line of code. :)
When I put this in Thonny and run it:
The window appears for a split second and then exits. If I add this:
Then the window appears. Need the same dummy draw method trick I use for static sketches.