DEV Community

Discussion on: Help me with Threading in this code. I am unable to figure out how to use threading in this

Collapse
 
htraprocks profile image
htraprocks

I am sorry, if something went wrong with publishing the code.(This was my first time).

1)This is the code snippet that I am trying to run.The main idea is that, I want the ipywidgets to be interactive, while the data is constantly being fetched from the data source. And the data is being updated at certain interval using the while loop.The objective is to plot the principal components interactively by changing the number of principal components(PC) to be considered, using the @interact function. Also it runs perfectly fine without while loop, that is, when we are not considering the auto-update for the dataset, with the while loop. But when I include the while loop, it doesn't handle the interactive-ness of the widgets(that is, the interaction of the number of PC). My feeling is that "while True" loop does not let the interaction of ipywidget to happen, due to some execution issue.

2) Also I looked into threading but i am unsure of how to use the fucntion which is in functools(select_data), be called using threading.Thread.

Any sort of help would be appreciated. Thanks