MCPcopy Create free account
hub / github.com/pywebio/PyWebIO / set_env

Function set_env

pywebio/session/__init__.py:501–533  ·  view source on GitHub ↗

configure the environment of current session. Available configuration are: * ``title`` (str): Title of current page. * ``output_animation`` (bool): Whether to enable output animation, enabled by default * ``auto_scroll_bottom`` (bool): Whether to automatically scroll the page to th

(**env_info)

Source from the content-addressed store, hash-verified

499
500
501def set_env(**env_info):
502 """configure the environment of current session.
503
504 Available configuration are:
505
506 * ``title`` (str): Title of current page.
507 * ``output_animation`` (bool): Whether to enable output animation, enabled by default
508 * ``auto_scroll_bottom`` (bool): Whether to automatically scroll the page to the bottom after output content,
509 it is closed by default. Note that after enabled, only outputting to ROOT scope can trigger automatic scrolling.
510 * ``http_pull_interval`` (int): The period of HTTP polling messages (in milliseconds, default 1000ms),
511 only available in sessions based on HTTP connection.
512 * ``input_panel_fixed`` (bool): Whether to make input panel fixed at bottom, enabled by default
513 * ``input_panel_min_height`` (int): The minimum height of input panel (in pixel, default 300px),
514 it should be larger than 75px. Available only when ``input_panel_fixed=True``
515 * ``input_panel_init_height`` (int): The initial height of input panel (in pixel, default 300px),
516 it should be larger than 175px. Available only when ``input_panel_fixed=True``
517 * ``input_auto_focus`` (bool): Whether to focus on input automatically after showing input panel, default is ``True``
518 * ``output_max_width`` (str): The max width of the page content area (in pixel or percentage,
519 e.g. ``'1080px'``, ``'80%'``. Default is 880px).
520
521 Example::
522
523 set_env(title='Awesome PyWebIO!!', output_animation=False)
524
525 .. versionchanged:: 1.4
526
527 Added the ``output_max_width`` parameter
528 """
529 from ..io_ctrl import send_msg
530 assert all(k in ('title', 'output_animation', 'auto_scroll_bottom', 'http_pull_interval', 'output_max_width',
531 'input_panel_min_height', 'input_panel_init_height', 'input_panel_fixed', 'input_auto_focus')
532 for k in env_info.keys())
533 send_msg('set_env', spec=env_info)
534
535
536def go_app(name, new_window=True):

Callers 7

targetFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
basic_outputFunction · 0.85
pageFunction · 0.85
mainFunction · 0.85

Calls 1

send_msgFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…