Closed
Description
Describe the bug
I want to trigger my own function for setup and drawing.
however this does not seem to work as my code below crashed at
File ".venv/lib/python3.11/site-packages/p5/sketch/userspace.py", line 260, in size p5.sketch.size = (builtins.width, builtins.height) AttributeError: 'NoneType' object has no attribute 'size'
It seems that on this size()
there is no sketch attribute to p5, but I have tried digging into but cant seem to understand why that is the case ?
To Reproduce
import p5
def setup():
p5.size(128,64)
p5.no_loop()
p5.fill(0)
def draw():
p5.background(204)
p5.text("LAX", (0, 40))
p5.text("LHR", (0, 70))
p5.text("TXL", (0, 100))
p5.run(sketch_setup=setup(),sketch_draw=draw())
Expected behavior
To be able to draw using custom defined function.
System information:
- p5 release (version number or latest commit):
- Python version: 3.11
- Operating system: Arch Linux
Metadata
Assignees
Labels
No labels