Hi again,

Ole Streicher <ole-usenet-s...@gmx.net> writes:
> could anyone reproduce this problem and/or has a solution for it? Is
> there anything wrong with my code?

after some discussion on the PyQt mailing list, I found the cause of the
problem:

In matplotlib.FigureCanvasQTAgg, the following piece of code is called
on a resizeEvent:

def draw( self ):

    # ... some internal code

    # Added following line to improve realtime pan/zoom on windows:
    QtGui.qApp.processEvents()

This makes the problem clear:
- if we resize the window quickly, several resizeEvents are created and
  are in the event queue of Qt
- the first one gets processed by the QVBoxLayout which starts the
  processing in its first (matplotlib) widget.
- the matplotlib widget does what it should and at some point calls 
  matplotlib.FigureCanvasQTAgg.draw(self).
  - this starts the processing of the next event in the queue which is
    the next (2nd) resize event. BUT: we are still in the processing of 
    the first event!!!
  - the 2nd event goes to the QVBoxLayout, from there to the matlotlib
    widget (eventually starting some recursive behaviour here)
  - if the 2nd event is finished, QVBoxLayout sends it to its other widget
    (the scrollbar). The scrollbar is resized according to the *2nd event*.
- if the processing of the 2nd event was finished and no more events are 
  in the queue, the matplotlib.FigureCanvasQTAgg.draw() finishes
- at the end, this will finish the processing of the first resize event 
  in the matplotlib widget and start the *first resize event* for the
  scrollbar

This is exactly the behaviour that I observed. It is caused by the
QtGui.qApp.processEvents() call in the draw() function.

So, I think this is clearly a bug in matplotlib:
QtGui.qApp.processEvents() should not be called while processing another
event.

Best regards

Ole


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to