Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

save() throws an error #437

Open
niklasbuhl opened this issue Jun 19, 2023 · 2 comments
Open

save() throws an error #437

niklasbuhl opened this issue Jun 19, 2023 · 2 comments
Labels

Comments

@niklasbuhl
Copy link

Describe the bug

I have made my first sketch, but if I try to use the save("image.png") function, it throws an error:

TypeError: VispyRenderer2D.save_canvas() missing 1 required positional argument: 'canvas'

To Reproduce
I have installed like this:

brew install glfw
pyenv install 3.10.12
mkdir <project>
cd <project>
pyenv local 3.10.12
python -m venv .venv
source .venv/bin/activate
git clone https://github.com/p5py/p5.git
cd p5
pip install .
code ../.

A simple sketch.py example:

from p5 import *

def setup():
	size(1024, 1024)
	stroke_weight(2)

def draw():

	background(255)

	noFill()
	stroke(0)
	
	begin_shape()

	vertex(100,100)
	vertex(200,100)
	vertex(100,200)
	vertex(200,200)

	end_shape(CLOSE)

def mouse_pressed():
	save("image.png")

if __name__ == '__main__':
	run()

Run
python sketch.py

Expected behavior
I expect an png image to be saved, when I click the mouse button.

System information:

  • Latest p5 release
  • Python version: 3.10.12
  • Operating system: MacOS 13.4 Ventura / 2,3 GHz Quad-Core Intel Core i7
@github-actions
Copy link
Contributor

Thank you for submitting your first issue to p5py

@tushar5526 tushar5526 added the bug label Jun 20, 2023
@dansmindspace
Copy link

dansmindspace commented Dec 15, 2023

Can add that this bug is present with Skia renderer.

TypeError: SkiaRenderer.save_canvas() missing 1 required positional argument: 'canvas'

Also save_frame gives this error:
AttributeError: 'SkiaSketch' object has no attribute 'queue_screenshot'

Note: save_frame does work with Vispy though you do need to specify the frame numbers manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants