Widget button displays when i use jupyter notebook but not jupyterlab.
The image is the jupyter notebook image
My jupyterlab shows
VBox(children=(Button(description=‘My Button’, style=ButtonStyle()), Output()))
Widget button displays when i use jupyter notebook but not jupyterlab.
The image is the jupyter notebook image
Something seems wrong or not compete then with your installation of ipywidgets. Or you aren’t using them in the same place? You are vague about the source of each.
One thing to try may be in your browser to just do a hard page refresh on the JupyterLab page where you are seeing VBox(children=(Button(description=‘My Button’, style=ButtonStyle()), Output()))
. Or try another browser? Ipywidgets changes a lot of things in your browser in relation to Jupyter and because browsers are made to hold on to the older data so that users often don’t see problems, it can be problematic for a bit with something this complicated.
Till morning the code was working but now when I try it shows empty.Is the desktop connectivity removed?
It is a very strict hard refresh that needs to be done. Not just a refresh. Assuming though you meant hard refresh…
Did you run this code fresh in the morning? The kernel has to be active and have everything in-memory. Before morning, did you try restarting the kernel and running the code. It is a good habit to adapt to restart the kernel and run all your code top to bottom regularly so the ‘hidden state’ doesn’t trip you up later. Also, sometimes just restarting the browser and computer is a good idea. Or try with another browser as I already suggested.
Beyond those suggestions…
A couple of things:
You should no longer be using an exclamation with pip install
. I have pointed this out to you before, see here. The magic version of %pip install
was added in 2019 to help avoid problems. Indeed, this may be causing you the issue you see. No guarantee though, yet the symptoms you describe are one of the reasons why the magic for this was added in 2019.
It seems widgets is making a button so it seems there is ‘connectivity’ of some sort, if that is what you mean…
This example in the last post is incomplete and so it makes it hard to help you in regard to this question. There are plenty of ways to share full code examples using GitHub gists or other code sharing resources. Or at least posting code as text here using code blocks with syntax highlighting, see the last two sentences here for more help on that.
Please read Getting good answers to your questions and play special attention to the fact screenshots of code are frowned on and minimal reproducible examples are strongly encouraged in the section ’ Help others reproduce the problem’ in the last resource listed there, How do I ask a good question?.
Example:
You can go here scroll to the bottom and choose what type of interface experience you want: JupyterLab or Jupyter Notebook by clicking on the appropriate launch button.
Then when that remote session starts up you can copy in the code cells from here and run them in turn to see them work. (Code actually hosted in this gist.) They are using ipywidgets.
https://stackoverflow.com/questions/79682743/how-to-correct-my-widget-code-which-was-working-before-and-now-it-displays-empty i have updated the question in stack overflow.
Are you using OneDrive by any chance? It moves things around in ways users don’t expect and then may produce things like you are now observing.
That is nice progress towards making a more detailed post. I’ll warn you though that it may possibly get closed as not being helpful to anyone except you since as you point out it is clearly something you did since it worked earlier. StackOverflow is usually meant to be for issues that may arise to more than just yourself. Sometimes you get lucky though.
At quick glance it also doesn’t look like an minimal reproducible example either. (Refers to files on your machine?) But maybe it is?
Keep in mind I should you how to actually make shareable reproducible examples using GitHub and MyBinder. Transferring it to something like that would be moving in the better direction.
Sorry.I found the issue was not with the code but was with directory = f’C:\Users\{os.getlogin()}\Downloads\’ the Downloads folder has no files to display.
Glad you solved it but please consider the comments here and on StackOverflow going forward. (Plus, review what is outlined in Getting good answers to your questions. ) Usually making a minimum reproducible example helps you clue on on the parts you need to further troubleshoot yourself.
I try projects on jupyternotebook first and the try if they work on pycharm or not.Years back when I was doing https://www.youtube.com/watch?v=yaOaG-LI9kI project I remember the button displayed in my pycharm environment and worked as well.But now it just shows
Do simpler ipywidgets examples work?
Also, this part seems not pertinent to this forum as it doesn’t involve Jupyter.
Jupyter has to consider it it’s connected to Widgets but.