Exemplo n.º 1
0
    def destroy(self, *args):
        if _debug:
            print "FigureManagerGTK.%s" % fn_name()
        self.window.destroy()

        if Gcf.get_num_fig_managers() == 0 and not matplotlib.is_interactive() and gtk.main_level() >= 1:
            gtk.main_quit()
Exemplo n.º 2
0
    def destroy(self, *args):
        if self.canvas._idle_callback:
            self.canvas._tkcanvas.after_cancel(self.canvas._idle_callback)

        self.window.destroy()

        if self._owns_mainloop and not Gcf.get_num_fig_managers():
            self.window.quit()
Exemplo n.º 3
0
    def destroy(self, *args):
        if _debug: print 'FigureManagerGTK.%s' % fn_name()
        self.window.destroy()

        if Gcf.get_num_fig_managers()==0 and \
               not matplotlib.is_interactive() and \
               gtk.main_level() >= 1:
            gtk.main_quit()
Exemplo n.º 4
0
 def destroy(self, *args):
     if Gcf.get_num_fig_managers()==0 and not matplotlib.is_interactive():
         if self.window is not None:
             self.window.quit()
     if self.window is not None:
         #self.toolbar.destroy()
         self.window.destroy()
         self.window = None
Exemplo n.º 5
0
    def destroy(self, *args):
        self.vbox.destroy()
        self.window.destroy()
        self.canvas.destroy()
        if self.toolbar:
            self.toolbar.destroy()

        if (Gcf.get_num_fig_managers() == 0
                and not matplotlib.is_interactive() and Gtk.main_level() >= 1):
            Gtk.main_quit()
Exemplo n.º 6
0
 def destroy(self, *args):
     if self.window is not None:
         #self.toolbar.destroy()
         if self.canvas._idle_callback:
             self.canvas._tkcanvas.after_cancel(self.canvas._idle_callback)
         self.window.destroy()
     if Gcf.get_num_fig_managers()==0:
         if self.window is not None:
             self.window.quit()
     self.window = None
Exemplo n.º 7
0
 def destroy(self, *args):
     if self.window is not None:
         #self.toolbar.destroy()
         if self.canvas._idle_callback:
             self.canvas._tkcanvas.after_cancel(self.canvas._idle_callback)
         self.window.destroy()
     if Gcf.get_num_fig_managers() == 0:
         if self.window is not None:
             self.window.quit()
     self.window = None
Exemplo n.º 8
0
 def destroy(self, *args):
     if _debug:
         print "FigureManagerGTK.%s" % fn_name()
     self.vbox.destroy()
     self.window.destroy()
     self.canvas.destroy()
     if self.toolbar:
         self.toolbar.destroy()
     self.__dict__.clear()
     if Gcf.get_num_fig_managers() == 0 and not matplotlib.is_interactive() and gtk.main_level() >= 1:
         gtk.main_quit()
Exemplo n.º 9
0
    def destroy(self, *args):
        self.vbox.destroy()
        self.window.destroy()
        self.canvas.destroy()
        if self.toolbar:
            self.toolbar.destroy()

        if (Gcf.get_num_fig_managers() == 0 and
                not matplotlib.is_interactive() and
                Gtk.main_level() >= 1):
            Gtk.main_quit()
Exemplo n.º 10
0
    def destroy(self, *args):
        if _debug: print('FigureManagerGTK3.%s' % fn_name())
        self.vbox.destroy()
        self.window.destroy()
        self.canvas.destroy()
        if self.toolbar:
            self.toolbar.destroy()

        if Gcf.get_num_fig_managers()==0 and \
               not matplotlib.is_interactive() and \
               Gtk.main_level() >= 1:
            Gtk.main_quit()
Exemplo n.º 11
0
    def destroy(self, *args):
        if _debug: print('FigureManagerGTK3.%s' % fn_name())
        self.vbox.destroy()
        self.window.destroy()
        self.canvas.destroy()
        if self.toolbar:
            self.toolbar.destroy()

        if Gcf.get_num_fig_managers()==0 and \
               not matplotlib.is_interactive() and \
               Gtk.main_level() >= 1:
            Gtk.main_quit()
    def destroy(self, *args):
        if _debug: print 'FigureManagerGTK3.%s' % fn_name()
        self.vbox.destroy()
        self.window.destroy()
        self.canvas.destroy()
        if self.toolbar:
            self.toolbar.destroy()
        self.__dict__.clear()  #Is this needed? Other backends don't have it.

        if Gcf.get_num_fig_managers()==0 and \
               not matplotlib.is_interactive() and \
               Gtk.main_level() >= 1:
            Gtk.main_quit()
Exemplo n.º 13
0
    def destroy(self, *args):
        if _debug: print 'FigureManagerGTK3.%s' % fn_name()
        self.vbox.destroy()
        self.window.destroy()
        self.canvas.destroy()
        if self.toolbar:
            self.toolbar.destroy()
        self.__dict__.clear()   #Is this needed? Other backends don't have it.

        if Gcf.get_num_fig_managers()==0 and \
               not matplotlib.is_interactive() and \
               Gtk.main_level() >= 1:
            Gtk.main_quit()
Exemplo n.º 14
0
    def destroy(self, *args):
        if _debug:
            print("FigureManagerGTK.%s" % fn_name())
        if hasattr(self, "toolbar") and self.toolbar is not None:
            self.toolbar.destroy()
        if hasattr(self, "vbox"):
            self.vbox.destroy()
        if hasattr(self, "window"):
            self.window.destroy()
        if hasattr(self, "canvas"):
            self.canvas.destroy()
        self.__dict__.clear()  # Is this needed? Other backends don't have it.

        if Gcf.get_num_fig_managers() == 0 and not matplotlib.is_interactive() and gtk.main_level() >= 1:
            gtk.main_quit()
Exemplo n.º 15
0
    def destroy(self, *args):
        if hasattr(self, 'toolbar') and self.toolbar is not None:
            self.toolbar.destroy()
        if hasattr(self, 'vbox'):
            self.vbox.destroy()
        if hasattr(self, 'window'):
            self.window.destroy()
        if hasattr(self, 'canvas'):
            self.canvas.destroy()
        self.__dict__.clear()  #Is this needed? Other backends don't have it.

        if Gcf.get_num_fig_managers()==0 and \
               not matplotlib.is_interactive() and \
               gtk.main_level() >= 1:
            gtk.main_quit()
Exemplo n.º 16
0
    def destroy(self, *args):
        if hasattr(self, 'toolbar') and self.toolbar is not None:
            self.toolbar.destroy()
        if hasattr(self, 'vbox'):
            self.vbox.destroy()
        if hasattr(self, 'window'):
            self.window.destroy()
        if hasattr(self, 'canvas'):
            self.canvas.destroy()
        self.__dict__.clear()   #Is this needed? Other backends don't have it.

        if Gcf.get_num_fig_managers()==0 and \
               not matplotlib.is_interactive() and \
               gtk.main_level() >= 1:
            gtk.main_quit()
Exemplo n.º 17
0
    def destroy(self, *args):
        if self._destroying:
            # Otherwise, this can be called twice when the user presses 'q',
            # which calls Gcf.destroy(self), then this destroy(), then triggers
            # Gcf.destroy(self) once again via
            # `connect("destroy", lambda *args: Gcf.destroy(self))`.
            return
        self._destroying = True
        self.vbox.destroy()
        self.window.destroy()
        self.canvas.destroy()
        if self.toolbar:
            self.toolbar.destroy()

        if (Gcf.get_num_fig_managers() == 0 and not mpl.is_interactive()
                and Gtk.main_level() >= 1):
            Gtk.main_quit()
Exemplo n.º 18
0
 def destroy(self, *args):
     if DEBUG: print 'FigureManagerGTK.%s' % fn_name()
     self.window.destroy()
     if Gcf.get_num_fig_managers()==0 and not matplotlib.is_interactive():
         gtk.main_quit()
Exemplo n.º 19
0
plt.rcdefaults()
plt.rcParams["backend"] = backend


def generate(X, Y, phi):
    R = 1 - np.hypot(X, Y)
    return np.cos(2 * np.pi * X + phi) * R


fig = plt.figure()
ax = fig.add_subplot(111)

# Make the X, Y meshgrid.
xs = np.linspace(-1, 1, 50)
ys = np.linspace(-1, 1, 50)
X, Y = np.meshgrid(xs, ys)

# Begin plotting.
tstart = time.process_time()
# Keep track of plotted frames, so that FPS estimate stays reasonable even
# after a ctrl-C's.
for i, phi in enumerate(np.linspace(0, 180. / np.pi, 100)):
    if not Gcf.get_num_fig_managers():
        break
    ax.lines.clear()
    Z = generate(X, Y, phi)
    ax.plot(X.flat, Z.flat, "ok")
    plt.pause(.001)

print("Average FPS: {}".format((i + 1) / (time.process_time() - tstart)))
Exemplo n.º 20
0
        def delayed_destroy():
            self.window.destroy()

            if self._owns_mainloop and not Gcf.get_num_fig_managers():
                self.window.quit()
Exemplo n.º 21
0
 def destroy(self, *args):
     if DEBUG: print 'FigureManagerGTK.%s' % fn_name()
     self.window.destroy()
     if Gcf.get_num_fig_managers()==0 and not matplotlib.is_interactive():
         gtk.main_quit()