當前位置: 首頁>>代碼示例>>Python>>正文


Python backend_tkagg.NavigationToolbar2Tk方法代碼示例

本文整理匯總了Python中matplotlib.backends.backend_tkagg.NavigationToolbar2Tk方法的典型用法代碼示例。如果您正苦於以下問題:Python backend_tkagg.NavigationToolbar2Tk方法的具體用法?Python backend_tkagg.NavigationToolbar2Tk怎麽用?Python backend_tkagg.NavigationToolbar2Tk使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在matplotlib.backends.backend_tkagg的用法示例。


在下文中一共展示了backend_tkagg.NavigationToolbar2Tk方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: view_init

# 需要導入模塊: from matplotlib.backends import backend_tkagg [as 別名]
# 或者: from matplotlib.backends.backend_tkagg import NavigationToolbar2Tk [as 別名]
def view_init(self):
        self.frame = tk.LabelFrame(self.browser.workframe, text=" Image ")
        self.frame.pack(side=tk.LEFT, fill=tk.BOTH, expand=True, padx=7, pady=7)
        self.figure = plt.figure(figsize=(8, 12), dpi=70)
        self.ax1 = plt.subplot2grid((50,40), (0, 0), rowspan=40, colspan=40)
        self.ax2 = plt.subplot2grid((50,40), (42, 0), rowspan=8, colspan=40, sharex=self.ax1)
        plt.subplots_adjust(left=0.1, bottom=0.05, right=0.95, top=0.97, wspace=0.2, hspace=0.2)
        self.view_plot_image()
        self.canvas = FigureCanvasTkAgg(self.figure, self.frame)

        if self.mpltlib3:
            self.canvas.draw()
            toolbar = NavigationToolbar2Tk(self.canvas, self.frame).update()
        else:
            self.canvas.show()
            toolbar = NavigationToolbar2TkAgg(self.canvas, self.frame).update()

        self.canvas.get_tk_widget().pack(side=tk.BOTTOM, fill=tk.BOTH, expand=True)

        self.canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, padx=2, pady=2, expand=True)
        self.frame.pack(side=tk.LEFT, fill=tk.BOTH, expand=True, padx=7, pady=7) 
開發者ID:aizquier,項目名稱:voyagerimb,代碼行數:23,代碼來源:voyagerimb.py

示例2: tabbed_tk_window

# 需要導入模塊: from matplotlib.backends import backend_tkagg [as 別名]
# 或者: from matplotlib.backends.backend_tkagg import NavigationToolbar2Tk [as 別名]
def tabbed_tk_window(self):
        from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk
        import sys
        if sys.version_info[0] < 3:
            import Tkinter as tkinter
            import ttk
        else:
            import tkinter
            from tkinter import ttk
        self.root_window = tkinter.Tk()
        self.root_window.title(self.title)
        # quit if the window is deleted
        self.root_window.protocol("WM_DELETE_WINDOW", self.root_window.quit)
        nb = ttk.Notebook(self.root_window)
        nb.grid(row=1, column=0, sticky='NESW')
        for name, fig in self.figures.items():
            fig.tight_layout()
            tab = ttk.Frame(nb)
            canvas = FigureCanvasTkAgg(self.figures[name], master=tab)
            canvas.draw()
            canvas.get_tk_widget().pack(side=tkinter.TOP, fill=tkinter.BOTH,
                                        expand=True)
            toolbar = NavigationToolbar2Tk(canvas, tab)
            toolbar.update()
            canvas._tkcanvas.pack(side=tkinter.TOP, fill=tkinter.BOTH,
                                  expand=True)
            for axes in fig.get_axes():
                if isinstance(axes, Axes3D):
                    # must explicitly allow mouse dragging for 3D plots
                    axes.mouse_init()
            nb.add(tab, text=name)
        nb.pack(side=tkinter.TOP, fill=tkinter.BOTH, expand=True)
        self.root_window.mainloop()
        self.root_window.destroy() 
開發者ID:MichaelGrupp,項目名稱:evo,代碼行數:36,代碼來源:plot.py

示例3: draw_toolbar

# 需要導入模塊: from matplotlib.backends import backend_tkagg [as 別名]
# 或者: from matplotlib.backends.backend_tkagg import NavigationToolbar2Tk [as 別名]
def draw_toolbar(canvas, root):
    toolbar = NavigationToolbar2Tk(canvas, root)
    toolbar.update()
    canvas._tkcanvas.pack(side='top', fill='both', expand=1)
    return 
開發者ID:shinnytech,項目名稱:tqsdk-python,代碼行數:7,代碼來源:futures_spot_spreads.py


注:本文中的matplotlib.backends.backend_tkagg.NavigationToolbar2Tk方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。