From 82de091c08df11c6593cacc32d1c42f3d67a0fc7 Mon Sep 17 00:00:00 2001 From: Jim Date: Tue, 3 Aug 2021 15:08:30 -0400 Subject: [PATCH] change sketch portal default throttle frame rate to 30 --- generator/reference.py | 2 +- py5_docs/Reference/api_en/Py5Tools_sketch_portal.txt | 6 +++--- py5_resources/py5_module/py5_tools/hooks/zmq_hooks.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/generator/reference.py b/generator/reference.py index d84effe2..2183088a 100644 --- a/generator/reference.py +++ b/generator/reference.py @@ -148,7 +148,7 @@ 'hook_post_draw: bool = False'], 'List[PIL.Image]') ], ('Py5Tools', 'sketch_portal'): [ - (['*', 'time_limit: float = 0.0', 'throttle_frame_rate: float = None', + (['*', 'time_limit: float = 0.0', 'throttle_frame_rate: float = 30', 'scale: float = 1.0', 'quality: int = 75', 'portal_widget: Py5SketchPortal = None', 'sketch: Sketch = None', 'hook_post_draw: bool = False'], 'None') diff --git a/py5_docs/Reference/api_en/Py5Tools_sketch_portal.txt b/py5_docs/Reference/api_en/Py5Tools_sketch_portal.txt index c9f02bd0..fe7fe578 100644 --- a/py5_docs/Reference/api_en/Py5Tools_sketch_portal.txt +++ b/py5_docs/Reference/api_en/Py5Tools_sketch_portal.txt @@ -5,7 +5,7 @@ category = sketch_hooks subcategory = None @@ signatures -sketch_portal(*, time_limit: float = 0.0, throttle_frame_rate: float = None, scale: float = 1.0, quality: int = 75, portal_widget: Py5SketchPortal = None, sketch: Sketch = None, hook_post_draw: bool = False) -> None +sketch_portal(*, time_limit: float = 0.0, throttle_frame_rate: float = 30, scale: float = 1.0, quality: int = 75, portal_widget: Py5SketchPortal = None, sketch: Sketch = None, hook_post_draw: bool = False) -> None @@ variables hook_post_draw: bool = False - attach hook to Sketch's post_draw method instead of draw @@ -13,7 +13,7 @@ portal_widget: Py5SketchPortal = None - Py5SketchPortal object to send stream to quality: int = 75 - JPEG stream quality between 1 (worst) and 100 (best) scale: float = 1.0 - scale factor to adjust the height and width of the portal sketch: Sketch = None - running Sketch -throttle_frame_rate: float = None - throttle portal frame rate below Sketch's frame rate +throttle_frame_rate: float = 30 - throttle portal frame rate below Sketch's frame rate time_limit: float = 0.0 - time limit in seconds for Sketch portal; set to 0 (default) for no limit @@ description @@ -29,7 +29,7 @@ If you are using Jupyter Lab, try right clicking in the output area of the cell This command can be called before :doc:`run_sketch` if the current Sketch is in the :doc:`is_ready` state. -Use the ``time_limit`` parameter to set a time limit (seconds). Use ``throttle_frame_rate`` to throttle the stream's frame rate (frames per second) to a slower pace than the Sketch's actual draw frame rate. The ``scale`` parameter is a scaling factor that can adjust the portal height and width. The ``quality`` parameter sets the JPEG quality factor (default 75) for the stream, which must be between 1 (worst) and 100 (best). If the portal causes the Sketch's frame rate to drop, try adjusting the portal's throttle frame rate, quality, and scale. +Use the ``time_limit`` parameter to set a time limit (seconds). Use ``throttle_frame_rate`` to throttle the stream's frame rate (frames per second) to a slower pace than the Sketch's actual draw frame rate. By default, ``throttle_frame_rate`` is set to 30, which is half of the Sketch's default draw frame rate of 60 frames per second. Set this parameter to ``None`` to disable throttling. The ``scale`` parameter is a scaling factor that can adjust the portal height and width. The ``quality`` parameter sets the JPEG quality factor (default 75) for the stream, which must be between 1 (worst) and 100 (best). If the portal causes the Sketch's frame rate to drop, try adjusting the portal's throttle frame rate, quality, and scale. If your Sketch has a ``post_draw()`` method, use the ``hook_post_draw`` parameter to make this function run after ``post_draw()`` instead of ``draw()``. This is important when using Processing libraries that support ``post_draw()`` such as Camera3D or ColorBlindness. diff --git a/py5_resources/py5_module/py5_tools/hooks/zmq_hooks.py b/py5_resources/py5_module/py5_tools/hooks/zmq_hooks.py index 18844294..a6c7410b 100644 --- a/py5_resources/py5_module/py5_tools/hooks/zmq_hooks.py +++ b/py5_resources/py5_module/py5_tools/hooks/zmq_hooks.py @@ -34,7 +34,7 @@ class Py5SketchPortal(widgets.Image): pass -def sketch_portal(*, time_limit: float = 0.0, throttle_frame_rate: float = None, +def sketch_portal(*, time_limit: float = 0.0, throttle_frame_rate: float = 30, scale: float = 1.0, quality: int = 75, portal: Py5SketchPortal = None, sketch: Sketch = None, hook_post_draw: bool = False) -> None: