? RE Dynamically updating embedding figures in GTK

I am trying to dynamically update some figures that I have embedded in GTK. The figures display fine and if I minimize and then maximize the window the figures update but I can’t get the figures to update dynamically as you watch the window. To try and get this working I used the code from one of the dynamic samples and just embedded it in my application.

Thanks

Melissa

tech.gif

···
##########################################################################
def create_AntennaResponseDisplay (self, title):

    fig = figure(5)
    ax = subplot(111)
   
    ind = arange(1,9)
    p1, p2, p3, p4, p5, p6, p7, p8 = bar(ind, self.get_stats())
    centers = ind + 0.5*p1.get_width()
    p1.set_facecolor('b')
    p2.set_facecolor('b')
    p3.set_facecolor('b')
    p4.set_facecolor('b')
    p5.set_facecolor('b')
    p6.set_facecolor('b')
    p7.set_facecolor('b')
    p8.set_facecolor('b')
   
    ax.set_xlim([0.5,9])
    ax.set_xticks(centers)
    ax.set_ylim([0,100])
    ax.set_xticklabels(['1', '2', '3', '4', '5', '6', '7', '8'])
    t = gcf().text(0.5, 0.95, title,
        horizontalalignment = 'center', fontsize = 10,)
   
    manager = get_current_fig_manager()
    

    def updatefig(*args):
        e1, e2, e3, e4, e5, e6, e7, e8 = self.get_stats()
   
        p1.set_height(e1)
        p2.set_height(e2)
        p3.set_height(e3)
        p4.set_height(e4)
        p5.set_height(e5)
        p6.set_height(e6)
        p7.set_height(e7)
        p8.set_height(e8)

        ax.set_ylim([0,100])       
        manager.canvas.draw()
        canvas.show()

        return gtk.TRUE

    gtk.timeout_add(250, updatefig)
   
    canvas = FigureCanvasGTK(fig)
    canvas.show()

    self.table1.attach(canvas, 2, 4, 4, 6)        # table1 is used to pack all my figures, buttons, etc. and is displayed in the main window
    
    self.table1.show()

##########################################################################
def get_memory(self):
    "Simulate a function that returns system memory"
    return 100*(0.5+0.5*sin(0.5*pi*time.time()))

##########################################################################
def get_cpu(self):
    "Simulate a function that returns cpu usage"
    return 100*(0.5+0.5*sin(0.2*pi*(time.time()-0.25)))

##########################################################################
def get_net(self):
    "Simulate a function that returns network bandwidth"
    return 100*(0.5+0.5*sin(0.7*pi*(time.time()-0.1)))

##########################################################################
def get_stats(self):
    return self.get_memory(), self.get_cpu(), self.get_net(), \
           self.get_memory(), self.get_cpu(), self.get_net(), \
           self.get_memory(), self.get_cpu()