ipywidgets icon indicating copy to clipboard operation
ipywidgets copied to clipboard

Text() causes run of @interact_manual decorated function on focus change ; but Textarea() does not

Open BenGardiner opened this issue 1 year ago • 0 comments

Description

Text() causes run of @interact_manual decorated function on focus change ; but Textarea() does not

Reproduce

@interact_manual
def doitdoitnow(arg=Textarea('arg')):
  print('u ran me')

when you change focus from the Textarea the function will not be invoked

@interact_manual
def doitdoitnow(arg=Text('arg')):
  print('u ran me')

when you change focus from the Text the function will be invoked

because Text() is the default for any string arguments it is also the case that any string arguments in a @interact_manual decorated function will get run when focus changes away from the automatically generated widget.

Expected behavior

For all functions decorated with @interact_manual the behaviour should be to ONLY execute the function when the button is pushed.

Context

  • ipywidgets version 8.1.2
  • Operating System and version: windows 10
  • Browser and version: chrome 124.0.6367.63
Troubleshoot Output
sys.version:
        3.9.7 (default, Sep 16 2021, 16:59:28) [MSC v.1916 64 bit (AMD64)]

platform.platform(): Windows-10-10.0.19045-SP0

pip list: Package Version Editable project location ------------------------- --------------- ------------------------------------------- anyio 4.3.0 argon2-cffi 23.1.0 argon2-cffi-bindings 21.2.0 arrow 1.3.0 asttokens 2.4.1 async-lru 2.0.4 attrs 23.2.0 Babel 2.14.0 backports.tarfile 1.1.1 beautifulsoup4 4.12.3 bitstring 3.1.9 black 24.4.2 bleach 6.1.0 bokeh 3.4.1 boto 2.49.0 build 1.2.1 cantact 0.1.2 certifi 2024.2.2 cffi 1.16.0 charset-normalizer 3.3.2 click 8.1.7 colorama 0.4.6 comm 0.2.1 contourpy 1.2.1 debugpy 1.8.1 decorator 5.1.1 defusedxml 0.7.1 docutils 0.21.2 EditorConfig 0.12.4 exceptiongroup 1.2.0 executing 2.0.1 fastjsonschema 2.19.1 fqdn 1.5.1 graphviz 0.20.3 h11 0.14.0 httpcore 1.0.4 httpx 0.27.0 idna 3.6 importlib-metadata 7.0.1 ipykernel 6.29.2 ipython 8.18.1 ipywidgets 8.1.2 isoduration 20.11.0 jaraco.classes 3.4.0 jaraco.context 5.3.0 jaraco.functools 4.0.1 jedi 0.19.1 Jinja2 3.1.3 jsbeautifier 1.14.11 json5 0.9.17 jsonpointer 2.4 jsonschema 4.21.1 jsonschema-specifications 2023.12.1 jupyter 1.0.0 jupyter_client 8.6.0 jupyter-console 6.6.3 jupyter_core 5.7.1 jupyter-events 0.9.0 jupyter-lsp 2.2.2 jupyter_server 2.12.5 jupyter_server_terminals 0.5.2 jupyterlab 4.1.2 jupyterlab_pygments 0.3.0 jupyterlab_server 2.25.3 jupyterlab_widgets 3.0.10 keyring 25.2.0 markdown-it-py 3.0.0 MarkupSafe 2.1.5 matplotlib-inline 0.1.6 mdurl 0.1.2 mistune 3.0.2 more-itertools 10.2.0 mypy-extensions 1.0.0 nbclient 0.9.0 nbconvert 7.16.1 nbformat 5.9.2 nest-asyncio 1.6.0 nh3 0.2.17 notebook 7.1.2 notebook_shim 0.2.4 numpy 1.26.4 overrides 7.7.0 packaging 23.2 pandas 2.2.1 pandocfilters 1.5.1 parso 0.8.3 pathspec 0.12.1 pillow 10.3.0 pip 24.0 pkginfo 1.10.0 platformdirs 4.2.0 prometheus_client 0.20.0 prompt-toolkit 3.0.43 psutil 5.9.8 pure-eval 0.2.2 pycanpcap 0.1 pycparser 2.21 Pygments 2.17.2 pyproject_hooks 1.1.0 pyserial 3.5 python-can 4.3.1 python-dateutil 2.8.2 python-json-logger 2.0.7 pytz 2024.1 pywin32 306 pywin32-ctypes 0.2.2 pywinpty 2.0.12 PyYAML 6.0.1 pyzmq 25.1.2 qgridnext 2.0.0 qtconsole 5.5.1 QtPy 2.4.1 readme_renderer 43.0 referencing 0.33.0 requests 2.31.0 requests-toolbelt 1.0.0 rfc3339-validator 0.1.4 rfc3986 2.0.0 rfc3986-validator 0.1.1 rich 13.7.1 RP1210 0.0.26 rpds-py 0.18.0 scapy 2.5.0 Send2Trash 1.8.2 setuptools 58.1.0 six 1.16.0 sniffio 1.3.0 soupsieve 2.5 stack-data 0.6.3 terminado 0.18.0 tinycss2 1.2.1 tomli 2.0.1 tornado 6.4 tqdm 4.62.3 traitlets 5.14.1 twine 5.0.0 types-python-dateutil 2.8.19.20240106 typing_extensions 4.9.0 tzdata 2024.1 uri-template 1.3.0 urllib3 2.2.1 wcwidth 0.2.13 webcolors 1.13 webencodings 0.5.1 websocket-client 1.7.0 wheel 0.41.2 widgetsnbextension 4.0.10 wrapt 1.16.0 xyzservices 2024.4.0 z3 0.2.0 z3-solver 4.13.0.0 zipp 3.17.0

  • Jupyter notebook version: 7.1.2
Installed Labextensions
        jupyterlab_pygments v0.3.0 enabled ok (python, jupyterlab_pygments)
        qgridnext v2.0.0 enabled ok (python, qgridnext)
        @jupyter-notebook/lab-extension v7.1.2 enabled ok
        @jupyter-widgets/jupyterlab-manager v5.0.10 enabled ok (python, jupyterlab_widgets)

BenGardiner avatar May 08 '24 14:05 BenGardiner