Skip to content

Commit 82de091

Browse files
committed
change sketch portal default throttle frame rate to 30
1 parent 0a80f33 commit 82de091

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

generator/reference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
'hook_post_draw: bool = False'], 'List[PIL.Image]')
149149
],
150150
('Py5Tools', 'sketch_portal'): [
151-
(['*', 'time_limit: float = 0.0', 'throttle_frame_rate: float = None',
151+
(['*', 'time_limit: float = 0.0', 'throttle_frame_rate: float = 30',
152152
'scale: float = 1.0', 'quality: int = 75',
153153
'portal_widget: Py5SketchPortal = None', 'sketch: Sketch = None',
154154
'hook_post_draw: bool = False'], 'None')

py5_docs/Reference/api_en/Py5Tools_sketch_portal.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ category = sketch_hooks
55
subcategory = None
66

77
@@ signatures
8-
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
8+
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
99

1010
@@ variables
1111
hook_post_draw: bool = False - attach hook to Sketch's post_draw method instead of draw
1212
portal_widget: Py5SketchPortal = None - Py5SketchPortal object to send stream to
1313
quality: int = 75 - JPEG stream quality between 1 (worst) and 100 (best)
1414
scale: float = 1.0 - scale factor to adjust the height and width of the portal
1515
sketch: Sketch = None - running Sketch
16-
throttle_frame_rate: float = None - throttle portal frame rate below Sketch's frame rate
16+
throttle_frame_rate: float = 30 - throttle portal frame rate below Sketch's frame rate
1717
time_limit: float = 0.0 - time limit in seconds for Sketch portal; set to 0 (default) for no limit
1818

1919
@@ description
@@ -29,7 +29,7 @@ If you are using Jupyter Lab, try right clicking in the output area of the cell
2929

3030
This command can be called before :doc:`run_sketch` if the current Sketch is in the :doc:`is_ready` state.
3131

32-
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.
32+
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.
3333

3434
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.
3535

py5_resources/py5_module/py5_tools/hooks/zmq_hooks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Py5SketchPortal(widgets.Image):
3434
pass
3535

3636

37-
def sketch_portal(*, time_limit: float = 0.0, throttle_frame_rate: float = None,
37+
def sketch_portal(*, time_limit: float = 0.0, throttle_frame_rate: float = 30,
3838
scale: float = 1.0, quality: int = 75,
3939
portal: Py5SketchPortal = None, sketch: Sketch = None,
4040
hook_post_draw: bool = False) -> None:

0 commit comments

Comments
 (0)