当前位置: 首页>>代码示例>>Python>>正文


Python FigureCanvasGTKAgg.mpl_disconnect方法代码示例

本文整理汇总了Python中matplotlib.backends.backend_gtkagg.FigureCanvasGTKAgg.mpl_disconnect方法的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasGTKAgg.mpl_disconnect方法的具体用法?Python FigureCanvasGTKAgg.mpl_disconnect怎么用?Python FigureCanvasGTKAgg.mpl_disconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.backends.backend_gtkagg.FigureCanvasGTKAgg的用法示例。


在下文中一共展示了FigureCanvasGTKAgg.mpl_disconnect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: MainView

# 需要导入模块: from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg [as 别名]
# 或者: from matplotlib.backends.backend_gtkagg.FigureCanvasGTKAgg import mpl_disconnect [as 别名]
class MainView(BasePlotView, gtk.Frame):
    """
    A Gtk Frame based plotting widget for dreampy
    that contains additional tool bar items for printing
    and adding notes
    """
    def __init__(self, win, **kwargs):
        gtk.Frame.__init__(self)
        BasePlotView.__init__(self, **kwargs)
        self.win = win
        self.title = None

        #Put some stuff
        # self.suppress_header = kwargs.get('suppress_header', False)
        # self.suppress_title = kwargs.get('suppress_title', False)
        # self.suppress_legend = kwargs.get('suppress_legend', False)
        self.vbox = gtk.VBox(False, 0)
        self.add(self.vbox)
        self.sw = gtk.ScrolledWindow()
        self.sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        self.vbox.pack_start(self.sw, True, True, 0)
        self.sw.show()
        self.f = Figure(figsize=(5,4), dpi=100)
        self.canvas = FigureCanvas(self.f)  # a gtk.DrawingArea
        self.canvas.set_size_request(400,300)
        self.sw.add_with_viewport (self.canvas)
        self.canvas.show_all()
        self.toolbar = NavToolBar(self.canvas, self.win)
        self.vbox.pack_start(self.toolbar, False, False)
        self.toolbar.show()
        self.vbox.show()
        # self.autoscale = True
        # self.xmin = None
        # self.xmax = None
        # self.ymin = None
        # self.ymax = None
        # self.image = None
        # self.hold_plot = False
        # self.keyid = None
        # self.filter = None
        # self.labelsize = 8
        # self.titlesize = 10
        # self.ticklabelsize = 8
        # self.ticklabelweight = 'normal'
        # self.labelweight = 'bold'
        # self.titleweight = 'bold'
        # self.legendsize = 8
        # self.legendweight = 'normal'
        # self.hdrlabelsize = 9
        # self.hdrlabelweight = 'normal'
        # self.cur_axname = None
        self.refresh_canvas()
        self.show_all()
        #self.gtk_catchup()
        
    def gtk_catchup(self):
        gtk.gdk.threads_enter()
        while gtk.events_pending():
            gtk.main_iteration()
        gtk.gdk.threads_leave()        
        
    def create_arrow_button(self, arrow_type, shadow_type):
        button = gtk.Button()
        self.arrow = gtk.Arrow(arrow_type, shadow_type)
        button.add(self.arrow)
        button.show()
        self.arrow.show()
        return button

    def list_widgets_turnoff(self):
        self.left_button.set_sensitive(False)
        self.right_button.set_sensitive(False)
        self.ignore_button.set_sensitive(False)        
        #if self.keyid:
        #    self.canvas.disconnect(self.keyid)


    def disconnect_event(self, sig):
        if self.canvas:
            self.canvas.mpl_disconnect(sig)

    def connect_event(self, eventname, eventfunc):
        if self.canvas:
            self.canvas.set_flags(gtk.CAN_FOCUS)  #to grab focus for keystrokes
            self.canvas.grab_focus()    #to grab focus for keystrokes
            return self.canvas.mpl_connect(eventname, eventfunc)

    def redraw_plot(self):
        if self.hold_plot is False:
            if hasattr(self.canvas, 'show_all'):
                self.canvas.show_all()
            self.canvas.draw()
        self.gtk_catchup()
开发者ID:gopastro,项目名称:pyphamas,代码行数:95,代码来源:plots.py


注:本文中的matplotlib.backends.backend_gtkagg.FigureCanvasGTKAgg.mpl_disconnect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。