qtconsole icon indicating copy to clipboard operation
qtconsole copied to clipboard

Horizontal scrolling not updated until wndow resize event

Open hrdl-github opened this issue 2 years ago • 3 comments

Wide figures (e.g. produced using import matplotlib.pyplot as plt; plt.figure(dpi=300); plt.plot([1,2,3])) are truncated when the window is narrow enough. Resizing the window causes the horizontal scrollbar to appear / be updated. Horizontal scrolling allows the entire figure to be viewed then.

qtconsole version: 5.5.1

hrdl-github avatar Dec 18 '23 21:12 hrdl-github

Hey @hrdl-github, thanks for reporting. I also think it's important to fix this issue but I don't have time to take a look at it.

Could you try to solve it to see how hard it is?

ccordoba12 avatar May 05 '24 15:05 ccordoba12

I don't know enough about GUI frameworks to make sense of this. Apparently both the vertical scroll bar's visibility policy and whether we update the vertical scrollbar's range influence whether the horizontal scrollbar behaves as expected.

Removing https://github.com/jupyter/qtconsole/blob/56e5a5ec5cfccf5afd098fe8bb5b2c558a1dc8f9/qtconsole/console_widget.py#L2556 while setting control.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn) seems to work. Doing the former with any other value or not explicitly setting affects prevents both scrollbars from being displayed.

Also, calling e.g. self._control.horizontalScrollBar().setRange(0, 10) in adjust_scrollbars() will cause this function to be called infinitely often.

hrdl-github avatar May 05 '24 16:05 hrdl-github

Under certain conditions this breaks vertical scrolling, so it's more of a starting point to investigate what goes wrong.

hrdl-github avatar May 06 '24 11:05 hrdl-github