Hi,

I've finally created a small script that demonstrates a bug that I've been enduring for a long time. I haven't seen it reported before, so I may be doing something wrong. The bug is as follows: Under certain conditions, in an embedded gtk application, when selecting an area with the "Zoom to rectangle" button from the toolbar the whole graph will jump upward temporarily, corrupting the screen and making it hard to select the proper area. The attached example is an extreme version of this (the effect would be smaller for a reasonably sized combo box).

Tested on Linux (Debian Squeeze).

Regards,
João Luís Silva
from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas

try:
    from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar
except ImportError:
    from matplotlib.backends.backend_gtk import NavigationToolbar2GTK as NavigationToolbar
    print "Using alternative toolbar"

from matplotlib.figure import Figure

import numpy as np
import gtk
from widgets import Widgets

N = 1024

class Window:
    def __init__(self):
        self.window = gtk.Window()
        self.window.connect("destroy", lambda x: gtk.main_quit())
        self.window.set_size_request(640,480)

        vbox1 = gtk.VBox()
        self.window.add(vbox1)
        vbox1.pack_start(gtk.ComboBox())
        vboxPlot = gtk.VBox()

        #Create the lower plot
        self.fig = Figure()
        self.ax = self.fig.add_subplot(111)
        self.canvas = FigureCanvas(self.fig)
        vboxPlot.pack_start(self.canvas)
        self.toolbar = NavigationToolbar(self.canvas, self.window)
        vboxPlot.pack_start(self.toolbar,False,False)
        vboxPlot.show_all()
        self.plot, = self.ax.plot(np.linspace(0.0,1.0,N), np.linspace(0.0,100.0,N),"b",ls='-')

        vbox1.pack_start(vboxPlot)
        self.window.show_all()

win = Window()
gtk.main()

<<attachment: plot_moves.png>>

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to