Hi, folks!

I am using matplotlib (for the first time ever) to embed some graphics in an
application written using python + pygtk + glade.
So, I inserted on a page of a notebook a vertical pane, containing a
treeview with data on the left pane, and a matplotlib bar graph of this data
on the right. I wrote some code to "highlight" the individual rectangle on
the graph concerning a given line of the treeview, activated by a click on
the treeview's line (selection of the line). The code is show below, where
self.hndBar is a list with the handles to all the Rectangle objects created
by the bar method:

    def show_component_on_bar_graph( self, widget ):
        selecao = self.treeComp.get_selection()
        ( modelo, iteravel ) = selecao.get_selected()
        if (iteravel ):
            idx = int( self.modeloComposicao.get_value( iteravel, 0 ) )

            barraAnterior = self.barraAtual
            if barraAnterior != '':
                print "barraAnterior = ", barraAnterior
                barraAnterior.set_facecolor( 'b' )
                barraAnterior.set_edgecolor( 'b' )
                barraAnterior.draw()
            barraAtual = self.hndBar[ idx - 1 ]
            self.barraAtual = barraAtual
            print "barraAtual = ", barraAtual
            barraAtual.set_facecolor( 'r' )
            barraAtual.set_edgecolor( 'r' )
            barraAtual.draw( )

My problem is: even though I call draw() twice, the figure is not
imeediately updated when the user selects a given line on the treeview. The
figure is updated only when I change the size of a pane. I tried using
matplotlib in interactive mode, adding the line

    matplotlib.interactive( True )

after the lines

    import matplotlib
    matplotlib.use( 'GTK' )

but it didn't work.
How can I make the figure be imeediately updated?

Thanks in advance,

Marcus Vinicius Eiffle Duarte
[EMAIL PROTECTED]
NiterĂ³i, RJ, Brasil
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to