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

Fix or update example code that makes assumptions about non-blocking run_sketch() #381

Closed
hx2A opened this issue Nov 21, 2023 · 2 comments
Closed

Comments

@hx2A
Copy link
Collaborator

hx2A commented Nov 21, 2023

From @villares on mastodon:

https://py5coding.org/reference/sketch_print_line_profiler_stats.html

Cheers @hx2A, this example assumes you are in an environment where py5.run_sketch() is non-blocking by default (the Jupyter Notebook environment if remember correctly). Maybe you should make and example where an event like a a key pressed triggers the stats printing?

There are probably other examples that make the same assumption.

@hx2A
Copy link
Collaborator Author

hx2A commented Dec 25, 2023

There are probably other examples that make the same assumption.

This is in 14 other places. For some of them, there isn't a way to re-write the examples to work if py5.run_sketch() is blocking. For those, I will change the example to use py5.run_sketch(block=False), which doesn't make any assumptions.

@hx2A
Copy link
Collaborator Author

hx2A commented Dec 25, 2023

This is now fixed.

The example for py5.print_line_profiler_stats() now uses the key_pressed() event.

http://dev.py5coding.org/reference/sketch_print_line_profiler_stats.html

Here are some examples of examples that now use py5.run_sketch(block=False) :

http://dev.py5coding.org/reference/sketch_is_ready.html
http://dev.py5coding.org/reference/sketch_hot_reload_draw.html
http://dev.py5coding.org/reference/sketch_finished.html

@hx2A hx2A closed this as completed Dec 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant