Skip to content

PlotWidget: ZeroDivisionError on resize while ignoring constraints #3

Closed
@pnmatt

Description

@pnmatt

On my app, I have some PlotWidgets (plotpy.plot.plotwidget.PlotWidget) inside several QWidgets with QGridLayouts. On the last QWidget, I have overloaded minimumSizeHint() to return QSize(100, 100), ignoring the size constraints of the PlotWidgets.
When resizing the widget window, and when the height or width of the widget reaches 0, plotpy raises a ZeroDivisionError.

Traceback:

Traceback (most recent call last):
  File "C:\...\python-3.8.10.amd64\lib\site-packages\plotpy\plot\base.py", line 712, in resizeEvent
    self.apply_aspect_ratio()
  File "C:\...\python-3.8.10.amd64\lib\site-packages\plotpy\plot\base.py", line 2222, in apply_aspect_ratio
    current_aspect = self.get_current_aspect_ratio()
  File "C:\...\python-3.8.10.amd64\lib\site-packages\plotpy\plot\base.py", line 2185, in get_current_aspect_ratio
    return fabs((h * dx) / (w * dy))
ZeroDivisionError: float division by zero

My Environment:

python 3.8.10
plotpy 2.0.1
guidata 3.2
PythonQwt 0.11.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions