Embedding / Integration an IDE or JupyterLite in wx-Application

Hello everyone!

I’m relatively new to programming and trying to create a wx-application for (initially) simple data analysis, such as comparing (=, !=, <,>) two csv or excel files.
At this point, my respect and many thanks to the developers of wx-python.

Here I have the following question:

is it possible to integrate an IDE or JupyterLite (since it can, supposedly, work without a server) or even JupyterLab itself into wxpython-app?

My goal is to give users as many analysis options as possible. Not to concentrate on the rest, such as creating the GUI etc., and at the same time being able to enjoy the nice wxWidgets such as Grid etc.

As more and more people acquire programming skills (including children), I can imagine that the topic has a future. However, I couldn’t find anything useful in the research.

Thank you very much for any help!

I just had a look as I did not know JupyterLite. This is running fully inside a browser by running the server as WebAssembly.

For you it’s probably the best to:

  • Launch the Jupyter server from the wx application as separate thread or process. Running as process would allow to keep the process over quitting and re-starting the wx application.
  • Add a wxWebView to your wx application and make it connect to the Jupyter backend.
1 Like

Thanks for the reply. didn’t have time on the weekend. yes, i’ll try that.

By launching the jupyter server from wx application did you mean calling the termial and starting jupyter from terminal? or do you know a more direct option?
Thank you

Check how ever you are using / launching Jupyter.
E.g. if you use jupyter-notebook.exe then just open it in an editor and look towards the end of the file to see what it is doing.
E.g.

# -*- coding: utf-8 -*-
import re
import sys
from notebook.app import main
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(main())

Then call the same function as new thread or process.

1 Like

Thanks for your answer.
Had to do something completely different, so sorry for the late reply.
Your tip worked. I was able to start an exe app in a thread.
Jupyter Lab, on the other hand, caused the wx-app to freeze or brought an exception:

ValueError: signal only works in main thread of the main interpreter.

I was able to get around that with multiprocessing. Based on the post: https://wiki.wxpython.org/MultiProcessing

for those interested :

jupyterLab_from_wx_app.py (2.3 KB)

Here I imported the RichTextCtrl from the demo and installed JupyterLab via pip.

then found the start-command:

from jupyterlab.labapp import LabApp
sys.exit(LabApp.launch_instance())