def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
self.configure(bg=BG_COLOR)
self.trends = Figure(figsize=(5, 5), dpi=100)
self.a = self.trends.add_subplot(111)
canvas = FigureCanvasTkAgg(self.trends, self)
canvas.show()
canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=1)
toolbar = NavigationToolbar2TkAgg(canvas, self)
toolbar.update()
canvas._tkcanvas.pack(side=tk.BOTTOM, fill=tk.BOTH, expand=1)
self.animation = FuncAnimation(self.trends, self.animate, 5000)
python类FigureCanvasTkAgg()的实例源码
def plot_window(self, fig, name=""):
top_fig = tk.Toplevel()
top_fig.lift()
top_fig.title(name)
top_fig.rowconfigure(1, weight=1)
def _quit():
top_fig.destroy()
canvas = FigureCanvasTkAgg(fig, master=top_fig)
canvas.show()
canvas.get_tk_widget().grid(row=1, column=0, columnspan = 3, pady=(15,15), padx=(25,25), sticky=tk.N+tk.S+tk.E+tk.W)
button = tk.Button(top_fig, height=1, width=20, text="Dismiss", bg='gray97', command=_quit, relief=tk.GROOVE)
button.grid(row=2, column=0, columnspan=1, sticky=tk.W, pady=(10,10), padx=(20,20))
toolbar_frame = tk.Frame(top_fig)
toolbar_frame.grid(row=0,column=0,columnspan=2, sticky=tk.W+tk.E)
NavigationToolbar2TkAgg( canvas, toolbar_frame )
top_fig.resizable(width=tk.FALSE, height=tk.FALSE)
def plot_window(self, fig, name=""):
top_fig = tk.Toplevel()
top_fig.lift()
top_fig.title(name)
top_fig.rowconfigure(1, weight=1)
def _quit():
top_fig.destroy()
canvas = FigureCanvasTkAgg(fig, master=top_fig)
canvas.show()
canvas.get_tk_widget().grid(row=1, column=0, columnspan = 3, pady=(15,15), padx=(25,25), sticky=tk.N+tk.S+tk.E+tk.W)
button = tk.Button(top_fig, height=1, width=20, text="Dismiss", bg='gray97', command=_quit, relief=tk.GROOVE)
button.grid(row=2, column=0, columnspan=1, sticky=tk.W, pady=(10,10), padx=(20,20))
toolbar_frame = tk.Frame(top_fig)
toolbar_frame.grid(row=0,column=0,columnspan=2, sticky=tk.W+tk.E)
NavigationToolbar2TkAgg( canvas, toolbar_frame )
top_fig.resizable(width=tk.FALSE, height=tk.FALSE)
def plot1(self, x, y, ticks, strlab, ID):
self.f = Figure(figsize=(3,4), dpi=100)
self.ax1 = self.f.add_subplot(111)
self.canvas = FigureCanvasTkAgg(self.f, master=root)
self.canvas.show()
self.canvas.get_tk_widget().grid(row = 0, column = 0, rowspan = 3, columnspan = 1, sticky = W+E+N+S)
self.ax1.set_xticklabels(ticks)
for tick in self.ax1.xaxis.get_major_ticks():
tick.label.set_fontsize(6)
# specify integer or one of preset strings, e.g.
#tick.label.set_fontsize('x-small')
tick.label.set_rotation(30)
if(strlab == "INT"):
self.ax1.set_title('Integral Graph: %s' % ID)
if(strlab == "FRQ"):
self.ax1.set_title('Frequency Graph: %s' % ID)
self.ax1.plot(x,y)
def plot2(self, x, y, ticks, strlab, ID):
self.f1 = Figure(figsize=(3,4), dpi=100)
self.ax2 = self.f1.add_subplot(111)
self.canvas4 = FigureCanvasTkAgg(self.f1, master=root)
self.canvas4.show()
self.canvas4.get_tk_widget().grid(row = 3, column = 0, rowspan = 3, columnspan = 1, sticky = W+E+N+S)
self.ax2.set_xticklabels(ticks)
for tick in self.ax2.xaxis.get_major_ticks():
tick.label.set_fontsize(6)
# specify integer or one of preset strings, e.g.
#tick.label.set_fontsize('x-small')
tick.label.set_rotation(30)
if(strlab == "INT"):
self.ax2.set_title('Integral Graph: %s' % ID)
if(strlab == "FRQ"):
self.ax2.set_title('Frequency Graph: %s' % ID)
self.ax2.plot(x,y)
# Search tree by ARB ID
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
label = tk.Label(self, text="Graph Page!", font=LARGE_FONT)
label.pack(pady=10,padx=10)
button1 = ttk.Button(self, text="Back to Home",
command=lambda: controller.show_frame(StartPage))
button1.pack()
canvas = FigureCanvasTkAgg(f, self)
canvas.show()
canvas.get_tk_widget().pack(side=tk.BOTTOM, fill=tk.BOTH, expand=True)
toolbar = NavigationToolbar2TkAgg(canvas, self)
toolbar.update()
canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
def __init__(self, master = []):
self.master = master
# Erstellen des Fensters mit Rahmen und Canvas
self.figure = Figure(figsize = (7, 7), dpi = 100)
self.frame_c = Frame(relief = GROOVE, bd = 2)
self.frame_c.pack(fill = BOTH, expand = 1,)
self.canvas = FigureCanvasTkAgg(self.figure, master = self.frame_c)
self.canvas.show()
self.canvas.get_tk_widget().pack(fill = BOTH, expand = 1)
# Erstellen der Toolbar unten
self.toolbar = NavigationToolbar2TkAgg(self.canvas, self.frame_c)
self.toolbar.update()
self.canvas._tkcanvas.pack(fill = BOTH, expand = 1)
def __init__(self,master=[]):
self.master=master
#Erstellen des Fensters mit Rahmen und Canvas
self.figure = Figure(figsize=(7,7), dpi=100)
self.frame_c=Frame(relief = GROOVE,bd = 2)
self.frame_c.pack(fill=BOTH, expand=1,)
self.canvas = FigureCanvasTkAgg(self.figure, master=self.frame_c)
self.canvas.show()
self.canvas.get_tk_widget().pack(fill=BOTH, expand=1)
#Erstellen der Toolbar unten
self.toolbar = NavigationToolbar2TkAgg(self.canvas, self.frame_c)
self.toolbar.update()
self.canvas._tkcanvas.pack( fill=BOTH, expand=1)
def __init__(self,master=[]):
self.master=master
#Erstellen des Fensters mit Rahmen und Canvas
self.figure = Figure(figsize=(7,7), dpi=100)
self.frame_c=Frame(relief = GROOVE,bd = 2)
self.frame_c.pack(fill=BOTH, expand=1,)
self.canvas = FigureCanvasTkAgg(self.figure, master=self.frame_c)
self.canvas.show()
self.canvas.get_tk_widget().pack(fill=BOTH, expand=1)
#Erstellen der Toolbar unten
self.toolbar = NavigationToolbar2TkAgg(self.canvas, self.frame_c)
self.toolbar.update()
self.canvas._tkcanvas.pack( fill=BOTH, expand=1)
def initialize_display(self):
self.openButton = tk.Button(self, text = "Open File", command = self.get_filepath)
self.openButton.grid(row = 0, column = 0)
# This is just here to easily close the app during testing
self.quitButton = tk.Button(self, text = "Quit", command = self.quit)
self.quitButton.grid(row = 1, column = 0)
# testing alternative plotting solution
f = Figure(figsize=(5, 4), dpi=100)
a = f.add_subplot(111)
t = arange(0.0, 3.0, 0.01)
s = sin(2*pi*t)
a.plot(t, s)
canvas = FigureCanvasTkAgg(f, master=drawing_panel)
canvas.show()
# canvas.get_tk_widget().grid(row = 10, column = 10)
# canvas._tkcanvas.grid(row = 10, column = 10)
canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=1)
# toolbar = NavigationToolbar2TkAgg(canvas, root)
# toolbar.update()
canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=1)
def __init__(self, root, controller):
f = Figure()
nticks = 10
ax = f.add_subplot(111, aspect='1')
ax.set_xticks([x*(x_max-x_min)/nticks+x_min for x in range(nticks+1)])
ax.set_yticks([y*(y_max-y_min)/nticks+y_min for y in range(1,nticks+1)])
ax.set_xlim((x_min, x_max))
ax.set_ylim((y_min, y_max))
canvas = FigureCanvasTkAgg(f, master=root)
canvas.show()
canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
canvas.mpl_connect('button_press_event', self.onclick)
toolbar = NavigationToolbar2TkAgg(canvas, root)
toolbar.update()
self.controllbar = ControllBar(root, controller)
self.f = f
self.ax = ax
self.canvas = canvas
self.controller = controller
self.contours = []
self.c_labels = None
self.plot_kernels()
def updateRegionMap(self, user_defined_update=False, time_dependent_update=False, time_dependent_year=None) :
# Re-plot the region map
self.view_edit_region_plot_axes.clear()
self.createRegionFigure(update=True, user_defined_update=user_defined_update, time_dependent_update=time_dependent_update, time_dependent_year=time_dependent_year)
if user_defined_update or time_dependent_update:
self.view_edit_region_canvas.draw()
else :
self.view_edit_region_window.title(self.view_edit_region_button_text.get())
self.view_edit_region_canvas.get_tk_widget().grid_remove()
self.view_edit_region_canvas = FigureCanvasTkAgg(self.view_edit_region_figure, master=self.view_edit_region_frame)
self.view_edit_region_canvas.show()
self.view_edit_region_canvas.get_tk_widget().grid(row=0, column=0)
if self.current_region == 'user-defined' :
if (self.region_mask > 0).any() :
self.user_defined_region_ok_button.configure(state=tk.NORMAL)
else :
self.user_defined_region_ok_button.configure(state=tk.DISABLED)
elif self.region_is_time_dependent[self.current_region] :
self.updateTimeDependentPreviousNext(time_dependent_year)
# Step 3 Method: Update Region Mask
def setup_GUI(fig):
# working with GUI --------------------------------------------
print '\ninitializing...'
GUI = tk.Tk()
GUI.title('CSL - Autovox')
GUI.minsize(150,150)
GUI.geometry('1280x400+0+0')
f0 = tk.Frame(GUI) # defining frame
f0.pack(fill='both',expand=True)
f0_area = tk.Canvas(f0, width=10,height=10) # defining canvas area within frame
f0_area.pack(side=tk.TOP)
graph = FigureCanvasTkAgg(fig)
graph.show()
graph.pack()
# but1 = tk.Button(f0, text='Show Voxel Build', height=1, width=15, command= lambda: show_vox_build())
# but1.pack(side=tk.RIGHT)
# f0_area.create_window(10,10, window=but1)
GUI.mainloop()
# -------------------------------------------------------------
def makeGraph(self):
self.graphFigure = Figure(figsize=(1,0.1), dpi=50, facecolor="black")
self.subplot = self.graphFigure.add_subplot(1,1,1, facecolor=(0.3, 0.3, 0.3))
self.subplot.tick_params(axis="y", colors="grey", labelbottom="off", bottom="off")
self.subplot.tick_params(axis="x", colors="grey", labelbottom="off", bottom="off")
self.graphFigure.axes[0].get_xaxis().set_ticklabels([])
self.graphFigure.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)
self.graphCanvas = FigureCanvasTkAgg(self.graphFigure, self)
self.graphCanvas.get_tk_widget().configure(bg="black")
self.graphCanvas.get_tk_widget().grid(row="2", column="2", columnspan="3", sticky="news")
yValues = self.mainWindow.characterDetector.playbackLogReader.logEntryFrequency
self.highestValue = 0
for value in yValues:
if value > self.highestValue: self.highestValue = value
self.subplot.plot(yValues, "dodgerblue")
self.timeLine, = self.subplot.plot([0, 0], [0, self.highestValue], "white")
#self.graphFigure.axes[0].set_xlim(0, len(yValues))
self.subplot.margins(0.005,0.01)
self.graphCanvas.show()
self.mainWindow.makeDraggable(self.graphCanvas.get_tk_widget())
def __init__(self, parent, settings, labelHandler, **kwargs):
tk.Frame.__init__(self, parent, **kwargs)
self.parent = parent
self.labelHandler = labelHandler
self.settings = settings
self.degree = 5
self.windowWidth = self.settings.getWindowWidth()
self.graphFigure = Figure(figsize=(4,2), dpi=100, facecolor="black")
self.subplot = self.graphFigure.add_subplot(1,1,1, facecolor=(0.3, 0.3, 0.3))
self.subplot.tick_params(axis="y", colors="grey", direction="in")
self.subplot.tick_params(axis="x", colors="grey", labelbottom="off", bottom="off")
self.graphFigure.axes[0].get_xaxis().set_ticklabels([])
self.graphFigure.subplots_adjust(left=(30/self.windowWidth), bottom=(15/self.windowWidth),
right=1, top=(1-15/self.windowWidth), wspace=0, hspace=0)
self.canvas = FigureCanvasTkAgg(self.graphFigure, self)
self.canvas.get_tk_widget().configure(bg="black")
self.canvas.get_tk_widget().pack(side=tk.BOTTOM, fill=tk.BOTH, expand=True)
self.canvas.show()
def __init__(self, root, controller):
f = Figure()
ax = f.add_subplot(111)
ax.set_xticks([])
ax.set_yticks([])
ax.set_xlim((x_min, x_max))
ax.set_ylim((y_min, y_max))
canvas = FigureCanvasTkAgg(f, master=root)
canvas.show()
canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
canvas.mpl_connect('button_press_event', self.onclick)
toolbar = NavigationToolbar2TkAgg(canvas, root)
toolbar.update()
self.controllbar = ControllBar(root, controller)
self.f = f
self.ax = ax
self.canvas = canvas
self.controller = controller
self.contours = []
self.c_labels = None
self.plot_kernels()
def __loadMatplotlib(self):
global FigureCanvasTkAgg, Figure
if FigureCanvasTkAgg is None:
try:
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
except:
FigureCanvasTkAgg = Figure = False
def addPlot(
self,
title,
t, s,
row=None,
column=0,
colspan=0,
rowspan=0):
self.__verifyItem(self.n_plots, title, True)
self.__loadMatplotlib()
if FigureCanvasTkAgg is False:
raise Exception("Unable to load MatPlotLib - plots not available")
else:
fig = Figure()
axes = fig.add_subplot(111)
axes.plot(t,s)
canvas = FigureCanvasTkAgg(fig, self.__getContainer())
canvas.fig = fig
canvas.axes = axes
canvas.show()
# canvas.get_tk_widget().pack(side=TOP, fill=BOTH, expand=1)
canvas._tkcanvas.pack(side=TOP, fill=BOTH, expand=1)
self.__positionWidget(canvas.get_tk_widget(), row, column, colspan, rowspan)
self.n_plots[title] = canvas
return axes
def init_ui(self, root):
self.figure = Figure(figsize=(5,5), dpi=100)
self.subplot = self.figure.add_subplot(111)
self.canvas = FigureCanvasTkAgg(self.figure, root)
self.canvas.show()
self.canvas.get_tk_widget().pack(fill=tk.BOTH, expand=1)
toolbar = NavigationToolbar2TkAgg(self.canvas, root)
toolbar.update()
def __init__(self, parent_window):
# Topic Names.
self.topic_names = self.get_topic_names()
self.main_label = Label(parent_window, text="RTK Fix Plot", font="Times 14 bold")
self.main_label.grid(row=0, columnspan=2)
# Plot for RTK fix.
self.first_receiver_state_received = False
self.first_time_receiver_state = 0
self.figure = Figure(figsize=(figureSizeWidth, figureSizeHeight), dpi=75)
self.axes_rtk_fix = self.figure.add_subplot(111)
self.axes_rtk_fix.set_xlabel('Time [s]')
self.axes_rtk_fix.set_ylabel('RTK Fix')
self.axes_rtk_fix.grid()
self.figure.tight_layout()
self.axes_rtk_fix.set_yticks([0.0, 1.0])
self.canvas = FigureCanvasTkAgg(self.figure, master=parent_window)
self.canvas.show()
self.canvas.get_tk_widget().grid(rowspan=4, columnspan=2)
# Position data.
self.odometry_msg_count = 0
self.time_rtk_fix = deque([], maxlen=maxLengthDequeArray)
self.rtk_fix = deque([], maxlen=maxLengthDequeArray)
self.line_rtk_fix = []
# Subscribe to topics.
rospy.Subscriber(self.topic_names['piksi_receiver_state'], ReceiverState,
self.receiver_state_callback)
def __loadMatplotlib(self):
global FigureCanvasTkAgg, Figure
if FigureCanvasTkAgg is None:
try:
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
except:
FigureCanvasTkAgg = Figure = False
def addPlot(
self,
title,
t, s,
row=None,
column=0,
colspan=0,
rowspan=0):
self.__verifyItem(self.n_plots, title, True)
self.__loadMatplotlib()
if FigureCanvasTkAgg is False:
raise Exception("Unable to load MatPlotLib - plots not available")
else:
fig = Figure()
axes = fig.add_subplot(111)
axes.plot(t,s)
canvas = FigureCanvasTkAgg(fig, self.__getContainer())
canvas.fig = fig
canvas.axes = axes
canvas.show()
# canvas.get_tk_widget().pack(side=TOP, fill=BOTH, expand=1)
canvas._tkcanvas.pack(side=TOP, fill=BOTH, expand=1)
self.__positionWidget(canvas.get_tk_widget(), row, column, colspan, rowspan)
self.n_plots[title] = canvas
return axes
def drawGraph(self, *args):
'''
Method to draw the matplotlib graph
'''
self.graphFrame = Tk.Frame(self.root)
f = Figure(figsize=(7,5), dpi=100)
subplot = f.add_subplot(111)
if self.plotType == 'line':
#a.plot(self.xAxis, self.yData)
subplot.plot(self.falseX, self.yData)
elif self.plotType == 'bar':
subplot.bar(self.xAxis, self.yData)
subplot.set_title(self.Title.get())
subplot.set_xlabel(self.xLabel.get())
subplot.set_ylabel(self.yLabel.get())
subplot.set_ylim(self.yMin.get(), self.yMax.get())
subplot.set_xlim(self.xMin.get(), self.xMax.get())
#a.set_xticklabels( self.xTicLabel.get(), rotation = 45)
#a.set_xticklabels(map(str, self.xAxis), rotation = 45)
subplot.xticks(self.falseX, map(str, self.xAxis), rotation='vertical')
# a tk.DrawingArea
self.canvas = FigureCanvasTkAgg(f, master = self.graphFrame)
self.canvas.show()
self.canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
self.canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
self.graphFrame.grid(row=1, rowspan=10)
def __init__(self, master):
self.frame = Tk.Frame(master)
self.fig = Figure( figsize=(7.5, 4), dpi=80 )
self.ax0 = self.fig.add_axes( (0.05, .05, .90, .90), axisbg=(.75,.75,.75), frameon=False)
self.frame.pack(side=Tk.LEFT, fill=Tk.BOTH, expand=1)
self.sidepanel=SidePanel(master)
self.canvas = FigureCanvasTkAgg(self.fig, master=self.frame)
self.canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
self.canvas.show()
def __init__(self, parent, plotdata, plotdata_files):
self.parent = parent
self.plots = plotdata # example: { "dgde" : { 0 : QPlotData_instance (from file 1), 1 : QPlotData_instance (from file 2) }, ... }, where 0,1,... are indices of the filenames in plotdata_files
self.plotdata_files = plotdata_files # [ "/home/.../pro/qa.PlotData.pickle", "/home/.../wat/qa.PlotData.pickle" ]
self.nrows = 1
self.ncols = 1
self.blocked_draw = False
self.subplot_lines = {}
self.COLORS_ACTIVE = ("#555555","#F75D59","#1589FF", "black", "red", "blue")
self.COLORS_INACTIVE = ("#aaaaaa","#F7bDb9","#a5a9FF", "#999999", "#FFaaaa", "#aaaaFF")
self.lb1_entries = ODict()
for plot_key, plot in self.plots.iteritems():
self.lb1_entries[ plot.values()[0].title ] = plot_key
self.lb1 = Tk.Listbox(self.parent, selectmode=Tk.EXTENDED, exportselection=0)
for plot_title in self.lb1_entries.keys():
self.lb1.insert(Tk.END, plot_title)
self.lb1.pack(fill=Tk.Y, side=Tk.LEFT)
self.lb2 = Tk.Listbox(self.parent, selectmode=Tk.EXTENDED, exportselection=0)
self.lb2.pack(fill=Tk.Y, side=Tk.LEFT)
self.figure = Figure(figsize=(5,4), dpi=100)
self.canvas = FigureCanvasTkAgg(self.figure, master=self.parent)
self.canvas.get_tk_widget().pack()
self.canvas._tkcanvas.pack(fill=Tk.BOTH, expand=1)
self.toolbar = NavigationToolbar2TkAgg( self.canvas, self.parent )
self.toolbar.update()
self.canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
self.lb1.bind("<<ListboxSelect>>", self.on_select_lb1)
self.lb2.bind("<<ListboxSelect>>", self.on_select_lb2)
self.parent.bind("<Configure>", self.on_resize)
def frame2(self):
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
self.frame2 = ttk.Frame(self.master, borderwidth = 2, relief = "groove")
self.frame2.place(bordermode = "outside", relwidth = 0.99, relheight = 0.72, relx = 0, rely = 0.22, x = 5, y = 5, anchor = "nw")
self.frame2.canvas = ttk.Frame(self.frame2, borderwidth = 0)
self.frame2.canvas.place(relwidth = 1, relheight = 1, relx = 0, anchor = "nw")
self.fig = Figure(figsize = (13, 6), facecolor = "white")
self.canvas = FigureCanvasTkAgg(self.fig, master = self.frame2.canvas)
self.fig.canvas.mpl_connect("button_press_event", self._onClick)
self.canvas.get_tk_widget().pack()
def __init__(self, parent, status, title):
ttk.Frame.__init__(self, parent)
self.status = status
self.canvas = FigureCanvasTkAgg(status.figure, self)
self.canvas.show()
self.canvas.get_tk_widget().pack(side=tk.BOTTOM, fill=tk.BOTH, expand=True)
self.animation = animation.FuncAnimation(status.figure, lambda i : status.update_plots(i), interval=1000)
def init_ui(self, root):
self.figure = Figure(figsize=(5,5), dpi=100)
self.subplot = self.figure.add_subplot(111)
self.canvas = FigureCanvasTkAgg(self.figure, root)
self.canvas.show()
self.canvas.get_tk_widget().pack(fill=tk.BOTH, expand=1)
toolbar = NavigationToolbar2TkAgg(self.canvas, root)
toolbar.update()
def __init__(self, master=[]):
self.master = master
#Erstellen des Fensters mit Rahmen und Canvas
self.figure = Figure(figsize=(7, 7), dpi=100)
self.frame_c = Frame(relief = GROOVE, bd = 2)
self.frame_c.pack(fill=BOTH, expand=1,)
self.canvas = FigureCanvasTkAgg(self.figure, master=self.frame_c)
self.canvas.show()
self.canvas.get_tk_widget().pack(fill=BOTH, expand=1)
#Erstellen der Toolbar unten
self.toolbar = NavigationToolbar2TkAgg(self.canvas, self.frame_c)
self.toolbar.update()
self.canvas._tkcanvas.pack(fill=BOTH, expand=1)
def __init__(self, master=None, iter=None):
self.master = master
self.iter = iter
self.frame_o = Frame(height=50, relief=GROOVE, bd=2)
self.frame_o.pack(fill=BOTH, expand=1)
self.but_update_plot = Button(master=self.frame_o,
text='Start Animation',
command=self.iter.start_animation)
self.but_update_plot.pack(fill=BOTH, expand=1)
self.figure = Figure(figsize=(6, 7), dpi=100)
# a tk.DrawingArea
self.frame_c = Frame(relief = GROOVE, bd = 2)
self.frame_c.pack(fill=BOTH, expand=1,)
self.canvas = FigureCanvasTkAgg(self.figure, master=self.frame_c)
self.canvas.show()
self.canvas.get_tk_widget().pack(fill=BOTH, expand=1)
self.toolbar = NavigationToolbar2TkAgg(self.canvas, self.frame_c)
self.toolbar.update()
self.canvas._tkcanvas.pack( fill=BOTH, expand=1)
self.ini_plot()