FHPythonUtils / Cli2Gui

Use this module to convert a cli program to a gui

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: Jupyterhub examples

JStatnekov opened this issue · comments

I'd really like to use cli2gui in a Jupyterhub project but I'm not sure if you're supporting that environment. I see that "web" is one of the GUI toolkits that's supported but perhaps that doesn't mean using Jupyterhub?

I've got a freshly built TLJH docker image from today's main head of https://github.com/jupyterhub/the-littlest-jupyterhub and have installed cli2gui by running "./pip install cli2gui" from within the /opt/tljh/user/bin directory of the running tljh docker instance. I've copied the contents of https://github.com/FHPythonUtils/Cli2Gui/blob/master/tests/argparse/test_10.py into a jupyterlab notebook cell (and commented out the top few file pathing stuff since cli2gui is already installed) . Upon running the cell, I get a tkinter error which suggests it's not detecting the Jupyter environment. The error is "TclError: no display name and no $DISPLAY environment variable." which makes a lot of sense since I'm not running this as a desktop app.

I'm hoping to get clarification that I can use your project within a Jupyter environment and if so, some pointers on how to get a working example.

I've found that this approach works well for detecting if a script is running under jupyter or not : https://stackoverflow.com/questions/15411967/how-can-i-check-if-code-is-executed-in-the-ipython-notebook

Honestly I've not played around with Jupyterhub before so I'm not sure. If you want to use the web flavour of pysimplegui then you need to install the extra and pass gui=pysimpleguiweb in the cli2gui decorator function

Also do you mind dropping full stack traces when you can just so I can see what part of cli2gui falls over (might be indicative of a bug for instance)