Request validation from user in python built extension

Hi all,
I’m currently developing nodes from python codes like proposed here : https://www.knime.com/blog/4-steps-for-your-python-team-to-develop-knime-nodes.
For a particular one I need to develop a node able to plot iteratively some data and for each output the user must choose to accept it or not (in this case it just need an ‘y/n’ and my script knows what to do after).
I already built this function for a python usage but the goal is to deploy it as a Knime Extension. I also precise that the algorithm does a loop over the plots and I must keep this loop structure due to other necessities.

Does anyone know if that task is possible by programming the extension in python?

Thanks in advance !
Baptiste

Hi Baptiste,

if you do it in a webportal, that could be done via any loop, but not in the KNINE Analytics Platform. Within a Python node itself such breaks for user input are never possible, as the Python process ends direclty after the node’s execution.

Hope this clarifies it. Don’t hesitate to ask further questions!

Best regards
Steffen

2 Likes

Hello Steffen,
In fact, that’s exactly what I’m currently trying to do. I have built an Tkinter window to plot and deal with user choices.
But for the moment, the string output that the user must enter can’t be stored (even though it can be in a jupyter notebook). I’ll keep searching a solution.

Thank you for your help !

Baptiste

just to clarify: you are trying to do that in the WebPortal, which is a feature of our commercial products?

Oh no, sorry for the confusion.
I wasn’t aware about the Knime WebPortal. I thought you were talking about developping the user interaction on a web interface coded in python inside my python module.
In my case, I’m using Tkinter to build a window interface which plot the data and gives choices to the user. In jupyter notebook this choice output can be stored to be used as a parameter for the rest of the code but this same script in the python module (and then run in Knime) seems to not be able to store it.

Baptiste

Hi Baptiste,

ok yes, then for the above reason this is not possible.
Why using Tkinter? My knowledge is already two years old, but back then PySimpleGUI seemed a lot more powerful (and/or easy to learn) to create a GUI with Python.

Best regards
Steffen

3 Likes

I don’t have any good reason to use Tkinter rather than another GUI. It’s just I’m brand new on this kind of subjet and Tkinter appeared to me in first. I will have a look to PySimpleGUI, which will be for sure interesting for my future works !

About the issue of my last comment, I think it’s a python problem and then out of this topic. The fact that building a GUI to interact with user works in python module is the answer I was looking for.
Thanks a lot for your advices !

Best regards,
Baptiste