Skip to content

fix resizeEvent in FigureCanvasQTAgg #17612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

fix resizeEvent in FigureCanvasQTAgg #17612

wants to merge 1 commit into from

Conversation

eyllanesc
Copy link

@eyllanesc eyllanesc commented Jun 10, 2020

When FigureCanvasQTAgg is used with a QSplitter the resizeEvent() method receives an event where the width or height can be 0 generating the winch or hinch to be 0 and this throws an exception:

Traceback (most recent call last):
  File "C:\Python36\lib\site-packages\matplotlib\backends\backend_qt5.py", line 397, in resizeEvent
    self.figure.set_size_inches(winch, hinch, forward=False)
  File "C:\Python36\lib\site-packages\matplotlib\figure.py", line 902, in set_size_inches
    raise ValueError(f'figure size must be positive finite not {size}')
ValueError: figure size must be positive finite not [0.   6.12]

A possible solution to the problem is to verify that the dimensions are positive, and that is what I have implemented in this PR.

Relative #17608

@tacaswell
Copy link
Member

We also have #17610 which adjust the check in question. I think that is slightly better as it make sure the widget and the figure agree on how big they are?

@tacaswell
Copy link
Member

@eyllanesc Now that #17610 is merged do we still need this change? Can you confirm that the current master branch works for you?

@QuLogic
Copy link
Member

QuLogic commented Jun 12, 2020

The example in #17608 no longer segfaults, so I think we don't need this anymore.

Thanks for the PR, @eyllanesc; hope to see you again if you find something else to improve.

@QuLogic QuLogic closed this Jun 12, 2020
@QuLogic QuLogic modified the milestones: v3.3.0, unassigned Jul 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants