• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python backend_gtkagg.NavigationToolbar2GTKAgg类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __init__

 def __init__(self, window, movie_frames, movie_file_maker):
     # set MPL NavigationToolbar
     NavigationToolbar2GTKAgg.__init__(self, movie_frames.canvas, window)
     # ===================================
     # movie file maker
     # ===================================
     self.mfm = movie_file_maker
     self.mfm.set_update_number_of_recorded_frames_function(self.update_saved_frames_numer)
     # Make Movie Button -----------------
     self.button_make_movie=gtk.ToolButton(gtk.STOCK_CDROM)
     self.button_make_movie.set_tooltip_text("Make movie file")
     # callback
     self.button_make_movie.connect("clicked",self.make_movie_callback)
     # pack button into tollbar
     self.insert(gtk.SeparatorToolItem(),8)
     self.insert(self.button_make_movie,9)
     # -----------------------------------
     # number of saved frames ------------
     self.saved_frames_label=gtk.Label('0')
     self.saved_frames_label.set_width_chars(4)
     # hbox with labels
     hbox=gtk.HBox()
     hbox.pack_start(gtk.Label('recorded:'),False,padding=3)
     hbox.pack_start(self.saved_frames_label,False)
     # tool item -- wrapper for hbox
     toolitem=gtk.ToolItem()
     toolitem.add(hbox)
     # pack them into tollbar
     self.insert(toolitem,10)
     self.insert(gtk.SeparatorToolItem(),11)       
开发者ID:atimokhin,项目名称:tdc_vis,代码行数:30,代码来源:navigation_toolbar.py


示例2: __init__

 def __init__(self, canvas, window, steps):
     NavigationToolbar2GTKAgg.__init__(self, canvas, window)
     item = self.get_nth_item(8)
     self.remove(item)
     self.playbutton = PlayButton()
     self.positionscale = PositionScale(steps)
     self.savemoviebutton = gtk.ToolButton(gtk.STOCK_SAVE_AS)
     self.insert(gtk.SeparatorToolItem(), 8)
     self.insert(self.playbutton, 9)
     self.insert(self.savemoviebutton, 10)
     self.insert(self.positionscale, 11)
     self.savemoviebutton.connect("clicked", self.handle_save_movie)
开发者ID:PiQuer,项目名称:pycppqed,代码行数:12,代码来源:animation.py


示例3: __init__

 def __init__(self, cube, canvas, parent_window):
     self.cube = cube
     NavigationToolbar2GTKAgg.__init__(self, canvas, parent_window)
开发者ID:bradenmacdonald,项目名称:astrocube,代码行数:3,代码来源:cubeview.py


示例4: draw

    def draw(self,widget, func):

        win = gtk.Window()
        win.connect("destroy", lambda x: gtk.main_quit())
        win.set_default_size(800,600)
        win.set_title("Chart statistiche PromoGest2")
        vbox = gtk.VBox()

        win.add(vbox)
        sw = gtk.ScrolledWindow()
        vbox.pack_start(sw, True, True, 0)
        sw.set_border_width (10)
        sw.set_policy (hscrollbar_policy=GTK_POLICYTYPE_AUTOMATIC,
               vscrollbar_policy=GTK_POLICYTYPE_ALWAYS)

        canvas = FigureCanvas(self.fig)  # a gtk.DrawingArea

        sw.add_with_viewport (canvas)
        toolbar = NavigationToolbar(canvas, win)
        toolbar.set_message(func)
        vbox.pack_start(toolbar, False, False, 0)
        win.set_modal(True)
        win.set_transient_for(None)
        win.show_all()
        gtk.main()
开发者ID:Alwnikrotikz,项目名称:promogest,代码行数:25,代码来源:chart.py


示例5: WidgetsWrapper

class WidgetsWrapper(object):
    def __init__(self):
        self.widgets = gtk.glade.XML('mpl_with_glade.glade')
        self.widgets.signal_autoconnect(GladeHandlers.__dict__)

        self['windowMain'].connect('destroy', lambda x: gtk.main_quit())
        self['windowMain'].move(10, 10)
        self.figure = Figure(figsize=(8, 6), dpi=72)
        self.axis = self.figure.add_subplot(111)

        t = arange(0.0, 3.0, 0.01)
        s = sin(2*pi*t)
        self.axis.plot(t, s)
        self.axis.set_xlabel('time (s)')
        self.axis.set_ylabel('voltage')

        self.canvas = FigureCanvas(self.figure)  # a gtk.DrawingArea
        self.canvas.show()
        self.canvas.set_size_request(600, 400)
        self.canvas.set_events(
            gtk.gdk.BUTTON_PRESS_MASK |
            gtk.gdk.KEY_PRESS_MASK |
            gtk.gdk.KEY_RELEASE_MASK
            )
        self.canvas.set_flags(gtk.HAS_FOCUS | gtk.CAN_FOCUS)
        self.canvas.grab_focus()

        def keypress(widget, event):
            print('key press')

        def buttonpress(widget, event):
            print('button press')

        self.canvas.connect('key_press_event', keypress)
        self.canvas.connect('button_press_event', buttonpress)

        def onselect(xmin, xmax):
            print(xmin, xmax)

        span = SpanSelector(self.axis, onselect, 'horizontal', useblit=False,
                            rectprops=dict(alpha=0.5, facecolor='red'))

        self['vboxMain'].pack_start(self.canvas, True, True)
        self['vboxMain'].show()

        # below is optional if you want the navigation toolbar
        self.navToolbar = NavigationToolbar(self.canvas, self['windowMain'])
        self.navToolbar.lastDir = '/var/tmp/'
        self['vboxMain'].pack_start(self.navToolbar)
        self.navToolbar.show()

        sep = gtk.HSeparator()
        sep.show()
        self['vboxMain'].pack_start(sep, True, True)

        self['vboxMain'].reorder_child(self['buttonClickMe'], -1)

    def __getitem__(self, key):
        return self.widgets.get_widget(key)
开发者ID:4over7,项目名称:matplotlib,代码行数:59,代码来源:mpl_with_glade.py


示例6: refreshGraphDisplay

 def refreshGraphDisplay( self ):
     
     # Remove existing graph items
     if self.graphCanvas != None:   
         self.vboxGraphs.remove( self.graphCanvas )
         self.graphCanvas.destroy()  
         self.graphCanvas = None   
     if self.graphNavToolbar != None:
         self.vboxGraphs.remove( self.graphNavToolbar )
         self.graphNavToolbar.destroy()  
         self.graphNavToolbar = None   
         
     # Draw the graphs
     self.graphFigure = Figure( figsize=(8,6), dpi=72 )
     self.graphAxis = self.graphFigure.add_subplot( 111 )
     #self.graphAxis.plot( range( 1, len( self.maxMotionCounts )+1 ), self.maxMotionCounts )
     diffs = [ 0 ] + [ self.leftMostMotionList[ i+1 ] - self.leftMostMotionList[ i ] for i in range( len( self.leftMostMotionList ) - 1 ) ]
     #self.graphAxis.plot( range( 1, len( self.leftMostMotionList )+1 ), self.leftMostMotionList )
     self.graphAxis.plot( range( 1, len( self.leftMostMotionList )+1 ), diffs )
     
     # Build the new graph display
     self.graphCanvas = FigureCanvas( self.graphFigure ) # a gtk.DrawingArea
     self.graphCanvas.show()
     self.graphNavToolbar = NavigationToolbar( self.graphCanvas, self.window )
     self.graphNavToolbar.lastDir = '/var/tmp/'
     self.graphNavToolbar.show()
     
     # Show the graph
     self.vboxGraphs.pack_start( self.graphNavToolbar, expand=False, fill=False )
     self.vboxGraphs.pack_start( self.graphCanvas, True, True )
     self.vboxGraphs.show()
     self.vboxGraphs.show()
开发者ID:Haris-Dani,项目名称:abroun-ros-pkg,代码行数:32,代码来源:ObjectDetectorExplorer.py


示例7: setup_plot

 def setup_plot(self, plot_controller):
     self.plot_controller = plot_controller
     self["matplotlib_box"].add(self.plot_controller.canvas)
     self["matplotlib_box"].show_all()
     self.nav_toolbar = NavigationToolbar(self.plot_controller.canvas, self.get_top_widget())
     self.nav_toolbar.set_name("navtoolbar")
     self["navtoolbar"] = self.nav_toolbar
     self["navtoolbar_box"].add(self.nav_toolbar)
开发者ID:claudioquaglia,项目名称:PyXRD,代码行数:8,代码来源:views.py


示例8: make_toolbar

    def make_toolbar(self):
        
        toolbar = NavigationToolbar(self.canvas, self)

        next = 8

        toolitem = gtk.SeparatorToolItem()
        toolitem.show()
        toolbar.insert(toolitem, next); next+=1
        toolitem.set_expand(False)

        self.buttonFollowEvents = gtk.CheckButton ()
        self.buttonFollowEvents.set_label('Auto')
        self.buttonFollowEvents.show()
        self.buttonFollowEvents.set_active(True)

        toolitem = gtk.ToolItem()
        toolitem.show()
 	
	#Rewriting this for the new gtk tooltips available in pygtk 2.12 and up	
	#toolitem.set_tooltip(
        #   toolbar.tooltips,
        #   'Automatically update in response to selections in EEG', 'Private')
	toolitem.set_tooltip_text('Automatically update in response to selections in EEG')

        toolitem.add(self.buttonFollowEvents)
        toolbar.insert(toolitem, next); next +=1

        # XXX: only available in gtk 2.6
        menu = gtk.MenuToolButton(gtk.STOCK_EDIT)
        menu.show()
        context = self.make_context_menu()
        menu.set_menu(context)

        #menu.set_tooltip(
        #   toolbar.tooltips,
        #   'Set filter/detrend etc', 'Private')
	menu.set_tooltip_text('Set filter/detrend etc')

        toolbar.insert(menu, next); next+=1

        toolitem = gtk.SeparatorToolItem()
        toolitem.show()
        toolbar.insert(toolitem, next)
        toolitem.set_expand(False)


        return toolbar
开发者ID:ashwinashok9111993,项目名称:pbrain,代码行数:48,代码来源:mpl_windows.py


示例9: add_figure_canvas

    def add_figure_canvas(self, w=700, h=500):
        """Note: this method assumed self.main_hbox is already
        defined.  A figure canvas with a toolbar at the bottom is
        added to self.main_hbox."""
        self.fig = Figure(figsize=(8,6), dpi=100)
        self.ax = self.fig.add_subplot(111)
        t = arange(0.0,3.0,0.01)
        s = sin(2*pi*t)
        self.ax.plot(t,s)

        self.figcanvas = FigureCanvas(self.fig)  # a gtk.DrawingArea
        self.figcanvas.show()
        self.canvas_vbox = gtk.VBox()
        toolbar = NavigationToolbar(self.figcanvas, self.window)
        #toolbar.set_size_request(-1,50)
        self.figcanvas.set_size_request(w,h)
        toolbar.set_size_request(w,50)
        toolbar.show()
        self.canvas_vbox.pack_start(self.figcanvas)#, expand=True, \
            #fill=True, padding=5)
        self.canvas_vbox.pack_start(toolbar, False)#, False)#, padding=5)
        self.main_hbox.pack_start(self.canvas_vbox)#, expand=True, \
开发者ID:ryanGT,项目名称:pygtk_guis,代码行数:22,代码来源:research_gui.py


示例10: _init_toolbar

 def _init_toolbar(self):
     NavigationToolbar._init_toolbar(self)
     image = gtk.Image()
     image.set_from_stock(gtk.STOCK_PRINT, 22)
     tbutton = gtk.ToolButton(image, 'Print')
     self.insert(tbutton, -1)
     tbutton.connect('clicked', getattr(self, 'print_canvas'))
     if not _new_tooltip_api:
         tbutton.set_tooltip(self.tooltips, 'Print current view',
                             'Private')
     else:
         tbutton.set_tooltip_text('Print current view')
     image = gtk.Image()
     image.set_from_stock(edit_img, 22)
     tbutton = gtk.ToolButton(image, 'Comments')
     self.insert(tbutton, -1)
     if not _new_tooltip_api:
         tbutton.set_tooltip(self.tooltips, 'Insert Comment to Plot',
                             'Private')
     else:
         tbutton.set_tooltip_text('Insert Comment to Plot')
     tbutton.connect('clicked', getattr(self,'insert_comments'))
     self.show_all()
开发者ID:gopastro,项目名称:pyphamas,代码行数:23,代码来源:plots.py


示例11: __init__

    def __init__ (self, plotters, fields):
        gtk.VBox.__init__ (self)

        self.figure = mpl.figure.Figure ()
        self.canvas = FigureCanvas (self.figure)
        self.canvas.unset_flags (gtk.CAN_FOCUS)
        self.canvas.set_size_request (600, 400)
        self.pack_start (self.canvas, True, True)
        self.canvas.show ()

        self.navToolbar = NavigationToolbar (self.canvas, self.window)
        #self.navToolbar.lastDir = '/tmp'
        self.pack_start (self.navToolbar, False, False)
        self.navToolbar.show ()

        self.checkboxes = gtk.HBox (len (plotters))
        self.pack_start (self.checkboxes, False, False)
        self.checkboxes.show ()

        self.pol = (1+0j, 0j)
        self.pol2 = None

        self.handlers = []

        i = 0
        self.plots = []
        for plotterClass, default in plotters:
            axes = self.figure.add_subplot (len (plotters), 1, i)
            def makeUpdateInfo (i): return lambda s: self.__updateInfo (i, s)
            def makeUpdatePos (i): return lambda s: self.__updatePos (i, s)
            plotter = plotterClass (axes, fields, makeUpdateInfo (i), makeUpdatePos (i))
            d = PlottedData (axes, plotter, default, self.__updateChildren)
            self.checkboxes.pack_start (d.checkBox, False, False)
            self.plots.append (d)
            i += 1
        self.__infos = [None] * len (self.plots)
        self.__posi = None

        self.legendBox = gtk.CheckButton ("Show legend")
        self.legendBox.set_active (True)
        self.legendBox.connect ("toggled", self.__on_legend_toggled)
        self.checkboxes.pack_start (self.legendBox, False, False)
        self.legendBox.show ()

        self.__updateChildren ()
开发者ID:aitatanit,项目名称:dda,代码行数:45,代码来源:plot_viewer.py


示例12: refreshGraphDisplay

 def refreshGraphDisplay( self ):
     
     if self.canvas != None:   
         self.hboxWorkArea.remove( self.canvas )
         self.canvas.destroy()  
         self.canvas = None   
     if self.navToolbar != None:
         self.vboxMain.remove( self.navToolbar )
         self.navToolbar.destroy()  
         self.navToolbar = None   
     
     self.canvas = FigureCanvas( self.figure ) # a gtk.DrawingArea
     self.canvas.show()
     self.hboxWorkArea.pack_start( self.canvas, True, True )
     self.hboxWorkArea.show()
     
     # Navigation toolbar
     self.navToolbar = NavigationToolbar( self.canvas, self.window )
     self.navToolbar.lastDir = '/var/tmp/'
     self.vboxMain.pack_start( self.navToolbar, expand=False, fill=False )
     self.navToolbar.show()
     self.vboxMain.show()
开发者ID:Haris-Dani,项目名称:abroun-ros-pkg,代码行数:22,代码来源:OpticalFlowExplorer.py


示例13: Figure

buttons['Open'] = gtk.ToolButton(gtk.STOCK_OPEN)
buttons['Save'] = gtk.ToolButton(gtk.STOCK_SAVE_AS)
buttons['ReMesh'] = gtk.Button("ReMesh")
buttons['MachDown'] = gtk.ToolButton(gtk.STOCK_GO_BACK)
buttons['MachDisp'] = gtk.Button("")
buttons['MachUp'] = gtk.ToolButton(gtk.STOCK_GO_FORWARD)
buttons['ReDown'] = gtk.ToolButton(gtk.STOCK_GO_BACK)
buttons['ReDisp'] = gtk.Button("")
buttons['ReUp'] = gtk.ToolButton(gtk.STOCK_GO_FORWARD)
buttons['NEDown'] = gtk.ToolButton(gtk.STOCK_GO_BACK)
buttons['NEDisp'] = gtk.Button("")
buttons['NEUp'] = gtk.ToolButton(gtk.STOCK_GO_FORWARD)

fig = Figure()
canvas = FigureCanvas(fig)  # a gtk.DrawingArea
nav = NavigationToolbar(canvas, win)
nav.set_size_request(250, 35);

sep = [gtk.SeparatorToolItem() for i in range(10)]

toolbar = gtk.HBox(False, 2)
toolbar.pack_start(buttons['New'], False, False, 0)
toolbar.pack_start(buttons['Open'], False, False, 0)
toolbar.pack_start(buttons['Save'], False, False, 0)
toolbar.pack_start(sep[0], False, False, 0)
toolbar.pack_start(nav, False, False, 0)
toolbar.pack_start(sep[1], False, False, 0)
toolbar.pack_start(combobox, False, False, 0)
toolbar.pack_start(sep[2], False, False, 0)
toolbar.pack_start(buttons['ReMesh'], False, False, 0)
toolbar.pack_start(sep[3], False, False, 0)
开发者ID:gomezstevena,项目名称:x-wind,代码行数:31,代码来源:xwind.py


示例14: show

    def show(self):
        try:
            if not self.packed:
                self.pack_start(self.canvas, expand=True)
                toolbar = NavigationToolbar(self.canvas, self.get_parent_window())

                next = 8
                button = gtk.Button('Lin y')
                button.show()
                button2 = gtk.Button('Lin x')
                button2.show()
                # linear/log
                def clicked(button):
                    self.adjust_axis_margins()
                    self.set_axis_labels()
                    self.color_labels()
                    self.canvas.draw_idle()
                    self.canvas.show()
                    if self.ax.get_yscale() == 'log':
                        button.set_label('Lin y')
                        self.ax.set_yscale('linear')
                    else:
                        button.set_label('Log y')
                        self.ax.set_yscale('log')
                    self.show()


                def clicked2(button):
                    self.adjust_axis_margins()
                    self.set_axis_labels()
                    self.color_labels()
                    self.canvas.draw_idle()
                    self.canvas.show()
                    if self.ax.get_xscale() == 'log':
                        button.set_label('Lin x')
                        self.ax.set_xscale('linear')
                    else:
                        button.set_label('Log x')
                        self.ax.set_xscale('log')
                    self.show()


                button.connect('clicked', clicked)
                button2.connect('clicked', clicked2)

                toolitem=gtk.ToolItem()
                toolitem.show()
                toolitem.add(button)
                toolbar.insert(toolitem, next)
                next +=1
                toolitem2=gtk.ToolItem()
                toolitem2.show()
                toolitem2.add(button2)
                toolbar.insert(toolitem2, next)


                self.pack_start(toolbar, expand=False)
                self.packed = True
            super(Figure, self).show()
        except Exception, e:
            print 'Exception: ', e
            raise
开发者ID:shimolu523,项目名称:lab-quanta,代码行数:62,代码来源:samfigure.py


示例15: AppView

class AppView(BaseView, HasChildView, FormattedTitleView):
    """
        The main application interface view.
        
        Attributes:
            project: the project view
            specimen: the specimen view
            markers: the markers view
            phases: the phases view
            atom_types: the atom_types view
            statistics: the statistics view
            mixtures: the mixtures view
            
        
    """
    builder = resource_filename(__name__, "glade/application.glade")
    top = "main_window"
    title_format = "PyXRD - %s"

    child_views = {
        "project": ProjectView,
        "specimen": SpecimenView,
        "markers": EditMarkersView, # FIXME this should be part of the specimen view/controller code
        "phases": ObjectListStoreView,
        "atom_types": ObjectListStoreView,
        # ("statistics": ???
        "mixtures": ObjectListStoreView
    }

    widget_groups = {
        'full_mode_only': [
            "tbtn_edit_phases",
            "tbtn_edit_atom_types",
            "tbtn_edit_mixtures",
            "tbtn_separator1",
            "btn_sample",
            "separator3",
            "separator4",
            "separator5",
            "main_menu_item_edit_phases",
            "main_menu_item_edit_atom_types",
            "main_menu_item_edit_mixtures",
            "navtoolbar"
        ]
    }

    # ------------------------------------------------------------
    #      Initialisation and other internals
    # ------------------------------------------------------------
    def __init__(self, *args, **kwargs):
        super(AppView, self).__init__(*args, **kwargs)

        # Setup about window:
        def on_aboutbox_response(dialog, response, *args):
            if response < 0:
                dialog.hide()
                dialog.emit_stop_by_name('response')

        def on_aboutbox_close(widget, event=None):
            self["about_window"].hide()
            return gtk.TRUE

        self["about_window"].set_version(settings.VERSION)
        pixbuf = gtk.gdk.pixbuf_new_from_file(resource_filename(__name__, "icons/pyxrd.png")) # @UndefinedVariable
        scaled_buf = pixbuf.scale_simple(212, 160, gtk.gdk.INTERP_BILINEAR) # @UndefinedVariable
        self["about_window"].set_logo(scaled_buf)
        self["about_window"].connect("response", on_aboutbox_response)
        self["about_window"].connect("close", on_aboutbox_close)
        self["about_window"].connect("delete_event", on_aboutbox_close)

        self["main_window"].set_icon_list(*get_icon_list())

        # self.set_layout_modes()
        self.reset_all_views()
        if not settings.DEBUG:
            self.get_top_widget().maximize()

        self.get_top_widget().show()

        return

    def setup_plot(self, plot_controller):
        self.plot_controller = plot_controller
        self["matplotlib_box"].add(self.plot_controller.canvas)
        self["matplotlib_box"].show_all()
        self.nav_toolbar = NavigationToolbar(self.plot_controller.canvas, self.get_top_widget())
        self.nav_toolbar.set_name("navtoolbar")
        self["navtoolbar"] = self.nav_toolbar
        self["navtoolbar_box"].add(self.nav_toolbar)

    def reset_child_view(self, view_name, class_type=None):
        if getattr(self, view_name, None) is not None:
            getattr(self, view_name).hide()
            setattr(self, view_name, None)
        if class_type == None:
            class_type = self.child_views[view_name]
        view = class_type(parent=self)
        setattr(self, view_name, view)
        view.set_layout_mode(self.current_layout_state)

#.........这里部分代码省略.........
开发者ID:claudioquaglia,项目名称:PyXRD,代码行数:101,代码来源:views.py


示例16: init

	def init(self):
		self.fig = Figure(figsize=(5,4), dpi=100)
		self.ax1=None
		self.show_key=True
		self.hbox=gtk.HBox()
		self.exe_command  =  get_exe_command()
		self.edit_list=[]
		self.line_number=[]
		gui_pos=0

		
		gui_pos=gui_pos+1

		self.draw_graph()
		canvas = FigureCanvas(self.fig)  # a gtk.DrawingArea
		#canvas.set_background('white')
		#canvas.set_facecolor('white')
		canvas.figure.patch.set_facecolor('white')
		canvas.set_size_request(500, 150)
		canvas.show()

		tooltips = gtk.Tooltips()

		toolbar = gtk.Toolbar()
		#toolbar.set_orientation(gtk.ORIENTATION_VERTICAL)
		toolbar.set_style(gtk.TOOLBAR_ICONS)
		toolbar.set_size_request(-1, 50)

		tool_bar_pos=0
		save = gtk.ToolButton(gtk.STOCK_SAVE)
		tooltips.set_tip(save, "Save image")
		save.connect("clicked", self.callback_save)
		toolbar.insert(save, tool_bar_pos)
		tool_bar_pos=tool_bar_pos+1

		hide_key = gtk.ToolButton(gtk.STOCK_INFO)
		tooltips.set_tip(hide_key, "Hide key")
		hide_key.connect("clicked", self.callback_hide_key)
		toolbar.insert(hide_key, tool_bar_pos)
		tool_bar_pos=tool_bar_pos+1

		image = gtk.Image()
   		image.set_from_file(os.path.join(get_image_file_path(),"play.png"))
		save = gtk.ToolButton(image)
		tooltips.set_tip(save, "Run simulation")
		save.connect("clicked", self.callback_refresh)
		toolbar.insert(save, tool_bar_pos)
		tool_bar_pos=tool_bar_pos+1

		plot_toolbar = NavigationToolbar(canvas, self)
		plot_toolbar.show()
		box=gtk.HBox(True, 1)
		box.set_size_request(500,-1)
		box.show()
		box.pack_start(plot_toolbar, True, True, 0)
		tb_comboitem = gtk.ToolItem();
		tb_comboitem.add(box);
		tb_comboitem.show()
		toolbar.insert(tb_comboitem, tool_bar_pos)
		tool_bar_pos=tool_bar_pos+1

		sep = gtk.SeparatorToolItem()
		sep.set_draw(False)
		sep.set_expand(True)
		toolbar.insert(sep, tool_bar_pos)
		sep.show()
		tool_bar_pos=tool_bar_pos+1

		toolbar.show_all()
		window_main_vbox=gtk.VBox()
		window_main_vbox.pack_start(toolbar, False, True, 0)
		#self.attach(toolbar, 0, 1, 0, 1)
		tool_bar_pos=tool_bar_pos+1




		self.hbox.pack_start(canvas, True, True, 0)
		#self.attach(canvas, 1, 3, 0, 1)



		vbox = gtk.VBox(False, 2)
	

		#spacer
		label=gtk.Label(" \n\n    ")
		#self.attach(label, 4, 5, 1, 2,gtk.SHRINK ,gtk.SHRINK)
		vbox.pack_start(label, False, False, 0)

		label.show()


		hbox = gtk.HBox(False, 2)
	    
		hbox.show()
		self.hbox.pack_start(vbox, False, False, 0)
		#self.attach(vbox, 3, 4, 0, 1,gtk.SHRINK ,gtk.SHRINK)
		vbox.show()
		window_main_vbox.add(self.hbox)
#.........这里部分代码省略.........
开发者ID:roderickmackenzie,项目名称:opvdm,代码行数:101,代码来源:qe.py


示例17: init

	def init(self):
		print "INIT!!"

		self.emesh_editor=electrical_mesh_editor()
		self.emesh_editor.init()

		self.fig = Figure(figsize=(5,4), dpi=100)
		self.ax1=None
		self.show_key=True
		self.hbox=gtk.HBox()
		self.edit_list=[]
		self.line_number=[]
		gui_pos=0

		gui_pos=gui_pos+1

		self.draw_graph()
		canvas = FigureCanvas(self.fig)  # a gtk.DrawingArea
		#canvas.set_background('white')
		#canvas.set_facecolor('white')
		canvas.figure.patch.set_facecolor('white')
		canvas.set_size_request(500, 150)
		canvas.show()

		tooltips = gtk.Tooltips()

		toolbar = gtk.Toolbar()
		#toolbar.set_orientation(gtk.ORIENTATION_VERTICAL)
		toolbar.set_style(gtk.TOOLBAR_ICONS)
		toolbar.set_size_request(-1, 50)

		tool_bar_pos=0
		save = gtk.ToolButton(gtk.STOCK_SAVE)
		tooltips.set_tip(save, "Save image")
		save.connect("clicked", self.callback_save)
		toolbar.insert(save, tool_bar_pos)
		tool_bar_pos=tool_bar_pos+1

		hide_key = gtk.ToolButton(gtk.STOCK_INFO)
		tooltips.set_tip(hide_key, "Hide key")
		hide_key.connect("clicked", self.callback_hide_key)
		toolbar.insert(hide_key, tool_bar_pos)
		tool_bar_pos=tool_bar_pos+1

		image = gtk.Image()
   		image.set_from_file(os.path.join(get_image_file_path(),"play.png"))
		save = gtk.ToolButton(image)
		tooltips.set_tip(save, "Run simulation")
		save.connect("clicked", self.run_simulation)
		toolbar.insert(save, tool_bar_pos)
		tool_bar_pos=tool_bar_pos+1

		plot_toolbar = NavigationToolbar(canvas, self)
		plot_toolbar.show()
		box=gtk.HBox(True, 1)
		box.set_size_request(500,-1)
		box.show()
		box.pack_start(plot_toolbar, True, True, 0)
		tb_comboitem = gtk.ToolItem();
		tb_comboitem.add(box);
		tb_comboitem.show()
		toolbar.insert(tb_comboitem, tool_bar_pos)
		tool_bar_pos=tool_bar_pos+1

		sep = gtk.SeparatorToolItem()
		sep.set_draw(False)
		sep.set_expand(True)
		toolbar.insert(sep, tool_bar_pos)
		sep.show()
		tool_bar_pos=tool_bar_pos+1

		help = gtk.ToolButton(gtk.STOCK_HELP)
		toolbar.insert(help, tool_bar_pos)
		help.connect("clicked", self.callback_help)
		help.show()
		tool_bar_pos=tool_bar_pos+1

		toolbar.show_all()
		window_main_vbox=gtk.VBox()
		window_main_vbox.pack_start(toolbar, False, True, 0)
		#self.attach(toolbar, 0, 1, 0, 1)
		tool_bar_pos=tool_bar_pos+1


		self.hbox.pack_start(canvas, True, True, 0)
	
		self.emesh_editor.show()
		self.hbox.pack_start(self.emesh_editor, True, True, 0)
		self.emesh_editor.mesh_dump_ctl.connect("update", self.callback_update)
		window_main_vbox.add(self.hbox)

		self.add(window_main_vbox)
		self.set_title("Electrical Mesh Editor - (www.opvdm.com)")
		self.set_icon_from_file(os.path.join(get_image_file_path(),"mesh.png"))
		self.connect("delete-event", self.callback_close)
		self.set_position(gtk.WIN_POS_CENTER)
开发者ID:roderickmackenzie,项目名称:opvdm,代码行数:96,代码来源:emesh.py


示例18: __init__

 def __init__(self, canvas, window):
     NavigationToolbar.__init__(self, canvas, window)
     self.comments = ''
     self.annotate = None
     self.page_setup=None
     self.settings = None
开发者ID:gopastro,项目名称:pyphamas,代码行数:6,代码来源:plots.py


示例19: __init__

class MainWindow:
 
    OPTICAL_FLOW_BLOCK_WIDTH = 8
    OPTICAL_FLOW_BLOCK_HEIGHT = 8
    OPTICAL_FLOW_RANGE_WIDTH = 8    # Range to look outside of a block for motion
    OPTICAL_FLOW_RANGE_HEIGHT = 8
    
    PROCESSED_FRAME_DIFF = 1
    
    # Classes of pixel in GrabCut algorithm
    GC_BGD = 0      # background
    GC_FGD = 1      # foreground
    GC_PR_BGD = 2   # most probably background
    GC_PR_FGD = 3   # most probably foreground 

    # GrabCut algorithm flags
    GC_INIT_WITH_RECT = 0
    GC_INIT_WITH_MASK = 1
    GC_EVAL = 2
 
    #---------------------------------------------------------------------------
    def __init__( self, options, bagFilename = None ):
    
        self.options = options
        self.scriptPath = os.path.dirname( __file__ )
        self.image = None
        self.frameIdx = 0
        self.workerThread = None
        self.numFramesProcessed = 0
        self.graphCanvas = None
        self.graphNavToolbar = None
        
        self.PROCESSED_FRAME_DIFF = int( self.options.frameSkip )
            
        # Setup the GUI        
        builder = gtk.Builder()
        builder.add_from_file( self.scriptPath + "/GUI/ObjectDetectorExplorer.glade" )
        
        self.window = builder.get_object( "winMain" )   
        self.comboOutput_1_Mode = builder.get_object( "comboOutput_1_Mode" )
        self.comboOutput_2_Mode = builder.get_object( "comboOutput_2_Mode" )
        self.vboxGraphs = builder.get_object( "vboxGraphs" )

        dwgInput = builder.get_object( "dwgInput" )
        dwgOutput_1 = builder.get_object( "dwgOutput_1" )
        dwgOutput_2 = builder.get_object( "dwgOutput_2" )
        self.dwgInputDisplay = Display( dwgInput )
        self.dwgOutput_1_Display = Display( dwgOutput_1 )
        self.dwgOutput_2_Display = Display( dwgOutput_2 )
        
        self.sequenceControls = builder.get_object( "sequenceControls" )
        self.sequenceControls.setNumFrames( 1 )
        self.sequenceControls.setOnFrameIdxChangedCallback( self.onSequenceControlsFrameIdxChanged )
        
        builder.connect_signals( self )
               
        #updateLoop = self.update()
        #gobject.idle_add( updateLoop.next )
        
        self.window.show()
        
        if bagFilename != None:
            self.tryToLoadBagFile( bagFilename )
        
    #---------------------------------------------------------------------------
    def onWinMainDestroy( self, widget, data = None ):  
        gtk.main_quit()
        
    #---------------------------------------------------------------------------   
    def main( self ):
        # All PyGTK applications must have a gtk.main(). Control ends here
        # and waits for an event to occur (like a key press or mouse event).
        gtk.gdk.threads_init()
        gtk.main()
        
    #---------------------------------------------------------------------------
    def isCurFrameReady( self ):
        return self.frameIdx < self.numFramesProcessed
        
    #---------------------------------------------------------------------------
    def setFrameIdx( self, frameIdx ):
        
        frameReady = frameIdx < self.numFramesProcessed
        
        if frameReady or frameIdx == 0:
            self.frameIdx = frameIdx
            self.updateDisplay()
        else:
            # Try to reset to current frame index
            if self.isCurFrameReady():
                self.sequenceControls.setFrameIdx( self.frameIdx )
            else:
                self.sequenceControls.setFrameIdx( 0 )
        
    #---------------------------------------------------------------------------
    def updateDisplay( self ):
        
        if self.isCurFrameReady():
            self.dwgInputDisplay.setImageFromOpenCVMatrix( self.inputImageList[ self.frameIdx ] )
            
#.........这里部分代码省略.........
开发者ID:Haris-Dani,项目名称:abroun-ros-pkg,代码行数:101,代码来源:ObjectDetectorExplorer.py


示例20: __init__

class HurricaneUI:
    
    def __init__(self):
        gladefile = "HurricaneUI.glade"
        builder = gtk.Builder()
        builder.add_from_file(gladefile)
        self.window = builder.get_object("mainWindow")
        builder.connect_signals(self)

        self.figure = Figure(figsize=(10,10), dpi=75)
        self.axis = self.figure.add_subplot(111)

        self.lat = 50
        self.lon = -100
        self.globe= globDisp.GlobeMap(self.axis, self.lat, self.lon)

        self.canvas = FigureCanvasGTK(self.figure)  
        self.canvas.show()
        self.canvas.set_size_request(500,500)

        self.globeview = builder.get_object("map")
        self.globeview.pack_start(self.canvas, True, True)

        self.navToolbar = NavigationToolbar(self.canvas, self.globeview)
        self.navToolbar.lastDir = '/var/tmp'
        self.globeview.pack_start(self.navToolbar)
        self.navToolbar.show()

        self.gridcombo = builder.get_object("gridsize")
        cell=gtk.CellRendererText()
        self.gridcombo.pack_start(cell,True)
        self.gridcombo.add_attribute(cell, 'text', 0)
        #self.gridcombo.set_active(2)

        # read menu configuration  
        self.gridopt = builder.get_object("gridopt").get_active()
        self.chkDetected = builder.get_object("detectedopt")
        self.detectedopt = self.chkDetected.get_active()
        self.chkHurricane = builder.get_object("hurricaneopt")
        self.hurricaneopt = self.chkHurricane.get_active()
        model = builder.get_object("liststore1")
        index = self.gridcombo.get_active()
        self.gridsize = model[index][0]
        radio = [ r for r in builder.get_object("classifieropt1").get_group() if r.get_active() ][0]
        self.sClassifier = radio.get_label()
        self.start = builder.get_object("startdate")
        self.end = builder.get_object("enddate")

        self.chkUndersample = builder.get_object("undersample")
        self.chkGenKey = builder.get_object("genKey")

        # disable unimplemented classifier selection
        builder.get_object("classifieropt2").set_sensitive(False)
        builder.get_object("classifieropt3").set_sensitive(False)
        builder.get_object("classifieropt4").set_sensitive(False)

        self.btnStore =  builder.get_object("store")
        self.datapath = 'GFSdat'
        self.trackpath = 'tracks'
        builder.get_object("btnDatapath").set_current_folder(self.datapath)
        builder.get_object("btnTrackpath").set_current_folder(self.trackpath)
        self.btnDetect =  builder.get_object("detect")

        # current operation status
        self.stormlocs = None
        self.detected = None
        self.clssfr = None

        # for test drawing functions
        if os.path.exists('demo.detected'):
            with open('demo.detected','r') as f:
                self.detected = pickle.load(f)
                self.stormlocs = pickle.load(f)
                self.chkHurricane.set_label(str(self.stormlocs.shape[0])+" Hurricanes")
                self.chkDetected.set_label(str(self.detected.shape[0])+" Detected")

        self.setDisabledBtns()

        # draw Globe
        self.drawGlobe()


    def setDisabledBtns(self):
        self.chkDetected.set_sensitive(self.detected!=None)
        self.chkHurricane.set_sensitive(self.stormlocs!=None)
        self.btnStore.set_sensitive(self.clssfr!=None)
        self.btnDetect.set_sensitive(self.clssfr!=None)
    
    def drawGlobe(self):
        self.globe.drawGlobe(self.gridsize, self.gridopt)
        if self.hurricaneopt : self.globe.drawHurricanes(self.stormlocs)
        if self.detectedopt : self.globe.fillGrids(self.detected)
        
    def main(self):
        self.window.show_all()
        gtk.main()

    def redraw(self):
        self.axis.cla()
        self.drawGlobe()
#.........这里部分代码省略.........
开发者ID:lemin,项目名称:hurricane,代码行数:101,代码来源:HurricaneUI.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python backend_pdf.PdfPages类代码示例发布时间:2022-05-27
下一篇:
Python backend_gtkagg.FigureCanvasGTKAgg类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap