magicgui icon indicating copy to clipboard operation
magicgui copied to clipboard

Example scripts from docu do not open GUI

Open constantinpape opened this issue 2 years ago • 2 comments

Describe the bug I have tried running the examples from https://pyapp-kit.github.io/magicgui/. For me none of them actually open a GUI. The python scripts execute without error or warning, but nothing happens.

To Reproduce Run the following in a python script:

from magicgui.widgets import create_widget
widget = create_widget(value="Hello World")
widget.show()

It does not open a window. (I have also tried with a bit more complex examples like https://pyapp-kit.github.io/magicgui/examples/basic/)

Expected behavior The scripts should open a GUI.

Environment (please complete the following information):

  • OS: Linux (Ubuntu 20.04)
  • backend: QT 5.4.1
  • magicgui version 0.7.2

And for reference, here's all relevant qt related packages:

$ conda list | grep qt
napari                    0.4.18          pyh2f63a43_0_pyqt    conda-forge
pyqt                      5.15.7          py310hab646b1_3    conda-forge
pyqt5-sip                 12.11.0         py310heca2aa9_3    conda-forge
qt-main                   5.15.8               h5d23da1_6    conda-forge
qtconsole                 5.4.1              pyhd8ed1ab_0    conda-forge
qtconsole-base            5.4.1              pyha770c72_0    conda-forge
qtpy                      2.3.1              pyhd8ed1ab_0    conda-forge
sphinxcontrib-qthelp      1.0.3                      py_0    conda-forge
superqt                   0.4.1              pyhd8ed1ab_0    conda-forge

constantinpape avatar Jul 18 '23 07:07 constantinpape

If you're not in an interactive environment, you need to add show(run=True).

I'll update the docs to be clearer and fix any examples

tlambert03 avatar Jul 18 '23 13:07 tlambert03

Thanks @tlambert03 , that fixes it! And indeed would be great to update the doc to make it clearer, I think it would be helpful to have a comment in the code snippets about this directly. (Feel free to close the issue or leave it open for a reminder about the doc update ;).)

constantinpape avatar Jul 18 '23 13:07 constantinpape