Problem with Draw function, large scale

Hi,

When trying to run the tutorials within VSCODE, the draw function yields a window where the scale is massive, and seems to have some sort of colour bar obscuring everything. I have tried searching for relevant posts, and have found this post which seems to have the exact same problem https://ngsolve.org/forum/ngspy-forum/1729-problem-with-draw however when trying to navigate to it from Google, I get a 403 error. On Google I see “I tried the following: - with VScode using an interactive window, but in this case I obtain an image with a very large scale and it’s impossible …” which is my exact problem.

It is frustrating that I cannot read the answers (if any) to this. I have attached a screenshot of the output from the Draw portion of the poisson.ipynb file. I am able to interact with the window, such as scrolling and moving around, but it is very hard to use, and the bar remains obscuring everything throughout.

I have Python 3.7.9, and used the windows installer (6.2.2301-win64.msi).

Hello,
I had the same problem trying to use the Draw function in Jupyter notebooks directly.
You can open an external window with “import netgen.gui” and there it works fine. They also did this in the youtube tutorials.
More workaround than solution but at least you can see stuff.

  • NGUnsolved

In vscode I guess it is possible that the webgui is not yet working correctly. In jupyter notebook in the browser it should work. What browser/operating system are you working on? Does it also happen in other browsers?

You are right. The problem seems to be VSCode. It works fine in the browser (linux).

Hi,

Sorry for the late reply, I was having trouble logging in as the reset password function on this forum doesn’t seem to work :slight_smile:

Using Jupyter notebook (Firefox, windows 10) is a workaround. Obviously not ideal since then you don’t get the useful features of working in VSCode. Using

import netgen.gui

as a replacement worked perfectly for me within VSCode.

I have similar problems on a windows machine. It would be great if the webgui could be fixed for vscode.

The Problem seems to be a fixed height of 50 viewport heights in this line: webgui_jupyter_widgets/widget.py at 03f983c9f15f68f238c1f895c44c101afe3f1fe7 · CERBSim/webgui_jupyter_widgets · GitHub

The viewport height seems to be totally different if the Notebook is opened in a webbrowser

or in visual studio code

in vsc a height of 3vh seems to be appropriate

It would be really great if you could fix this.

Best regards, Nils

1 Like

There is a new version for the webgui-jupyter-widgets and now a workaround is possible:

first update the module:

pip install webgui-jupyter-widgets -U

then you have to create the plot, clear the output and recreate the plot with a defined height:

scene = Draw(gfu, mesh)
clear_output()
scene.Draw(height="3vh")
2 Likes