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


Python FigureCanvasGTK3Cairo.supports_blit方法代码示例

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


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

示例1: __init__

# 需要导入模块: from matplotlib.backends.backend_gtk3cairo import FigureCanvasGTK3Cairo [as 别名]
# 或者: from matplotlib.backends.backend_gtk3cairo.FigureCanvasGTK3Cairo import supports_blit [as 别名]
    def __init__(self, sigs={}, fig=None, title='', uidir=''):
        oscopy.Figure.__init__(self, None, fig)
        self.to_figure = [Gtk.TargetEntry.new("text/plain",
                                              Gtk.TargetFlags.SAME_APP,
                                              self.TARGET_TYPE_SIGNAL)]
        self.hadjpreval = None
        self.vadjpreval = None
        self.current_axes = None

        # The canvas for the Figure
        canvas = FigureCanvas(self)
        canvas.supports_blit = False
        canvas.mpl_connect('button_press_event', self.button_press)
        canvas.mpl_connect('scroll_event', self.mouse_scroll)
        canvas.mpl_connect('axes_enter_event', self.axes_enter)
        canvas.mpl_connect('axes_leave_event', self.axes_leave)
        canvas.mpl_connect('figure_enter_event', self.figure_enter)
        canvas.mpl_connect('figure_leave_event', self.figure_leave)
        canvas.mpl_connect('key_press_event', self.key_press)
        canvas.mpl_connect('motion_notify_event', self.show_coords)
        self.canvas = canvas
        self.draw_hid = canvas.mpl_connect('draw_event', self.update_scrollbars)

        # The GtkBuilder
        builder = Gtk.Builder()
        builder.add_from_file('/'.join((uidir, IOSCOPY_GTK_FIGURE_UI)))
        self.builder = builder
        self.uidir = uidir

        # The window
        w = builder.get_object('w')
        w.set_title(title)
        w.drag_dest_set(Gtk.DestDefaults.ALL, self.to_figure, Gdk.DragAction.COPY)

        # Init the store for the combo box
        store = builder.get_object('store')
        iter = store.append([_('All Graphs'), False, True, False, Gtk.Adjustment(), Gtk.Adjustment()])
        for i in range(4):
            iter = store.append([_('Graph %d') % (i + 1), False, True if i < len(self.graphs) else False, False, Gtk.Adjustment(), Gtk.Adjustment()])
        self.cbx_store = store

        # The Graph Combobox
        graphs_cbx = builder.get_object('graphs_cbx')
        graphs_cbx.set_active(0)

        # Add remaining widgets
        builder.get_object('box').pack_start(canvas, True, True, 0)

        # Expose widgets needed elsewhere
        self.window = w
        self.hbar = builder.get_object('hbar')
        self.vbar = builder.get_object('vbar')
        self.coords_lbl1 = builder.get_object('coord_lbl1')
        self.coords_lbl2 = builder.get_object('coord_lbl2')
        self.graphs_cbx = graphs_cbx
        self.store = store
        self.mpsel_get_act = [builder.get_object('rb%d' % (b + 1)).get_active for b in range(4)]
        self.mpsel_set_act = [builder.get_object('rb%d' % (b + 1)).set_active for b in range(4)]
        self.mpsel_set_sens = [builder.get_object('rb%d' % (b + 1)).set_sensitive for b in range(4)]
        self.window.show_all()

        # Actions
        a = Gio.SimpleAction.new('set_range', GLib.VariantType.new('t'))
        a.connect('activate', self.set_range_activated)
        self.window.add_action(a)

        a = Gio.SimpleAction.new('set_units', GLib.VariantType.new('t'))
        a.connect('activate', self.set_units_activated)
        self.window.add_action(a)

        a = Gio.SimpleAction.new_stateful('set_scale', GLib.VariantType.new('(ts)'), GLib.Variant.new_string('lin'))
        a.connect('activate', self.set_scale_activated)
        self.window.add_action(a)

        a = Gio.SimpleAction.new('remove_signal', GLib.VariantType.new('(ts)'))
        a.connect('activate', self.remove_signal_activated)
        self.window.add_action(a)

        # Connect additional GTK signals
        cbmap = {'span_toggle_btn_toggled': self.span_toggle_btn_toggled,
                 'x10_toggle_btn_toggled': self.x10_toggle_btn_toggled,
                 'hadj_pressed': self.hadj_pressed,
                 'hadj_released': self.hadj_released,
                 'hscroll_change_value': self.hscroll_change_value,
                 'vadj_pressed': self.vadj_pressed,
                 'vadj_released': self.vadj_released,
                 'vscroll_change_value': self.vscroll_change_value,
                 'disable_adj_update_on_draw': self.disable_adj_update_on_draw,
                 'enable_adj_update_on_draw': self.enable_adj_update_on_draw,
                 'update_scrollbars': self.update_scrollbars,
                 'save_fig_btn_clicked': self.save_fig_btn_clicked,
                 'delete_event_cb': lambda w, e: w.hide() or True,
                 }
        builder.connect_signals(cbmap)
        graphs_cbx.connect('changed', self.graphs_cbx_changed,
                           (builder.get_object('x10_toggle_btn'),
                            builder.get_object('span_toggle_btn'),
                            store))

        # Add signals
#.........这里部分代码省略.........
开发者ID:agardelein,项目名称:oscopy,代码行数:103,代码来源:gtk_figure.py


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