Ejemplo n.º 1
1
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        label = tk.Label(self, text="Red = train\nBlue = test", font=LARGE_FONT)
        label.pack(pady=10,padx=10,side=tk.RIGHT)

        '''
        check_button_train_var = tk.IntVar()
        check_button_train = tk.Checkbutton(self, text="Show Train Data", variable=check_button_train_var, \
                            onvalue=1, offvalue=0, height=5, \
                            width=20)
        check_button_train.pack(side = tk.RIGHT) # pady=5, padx=5,

        check_button_test_var = tk.IntVar()
        check_button_test = tk.Checkbutton(self, text="Show Test Data", variable=check_button_test_var, \
                                            onvalue=1, offvalue=0, height=5, \
                                            width=20)
        check_button_test.pack(side=tk.RIGHT)
        '''

        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)

        draw_handler = DrawHandler(canvas)
Ejemplo n.º 2
1
    def build_graph(self):
        """ Update the plot area with loss values and cycle through to
        animate """
        self.ax1.set_xlabel('Iterations')
        self.ax1.set_ylabel('Loss')
        self.ax1.set_ylim(0.00, 0.01)
        self.ax1.set_xlim(0, 1)

        losslbls = [lbl.replace('_', ' ').title() for lbl in self.losskeys]
        for idx, linecol in enumerate(['blue', 'red']):
            self.losslines.extend(self.ax1.plot(0, 0,
                                                color=linecol,
                                                linewidth=1,
                                                label=losslbls[idx]))
        for idx, linecol in enumerate(['navy', 'firebrick']):
            lbl = losslbls[idx]
            lbl = 'Trend{}'.format(lbl[lbl.rfind(' '):])
            self.trndlines.extend(self.ax1.plot(0, 0,
                                                color=linecol,
                                                linewidth=2,
                                                label=lbl))

        self.ax1.legend(loc='upper right')

        plt.subplots_adjust(left=0.075, bottom=0.075, right=0.95, top=0.95,
                            wspace=0.2, hspace=0.2)

        plotcanvas = FigureCanvasTkAgg(self.fig, self.frame)
        plotcanvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=True)
        ani = animation.FuncAnimation(self.fig, self.animate, interval=2000, blit=False)
        plotcanvas.draw()
def PlotGraph(xValues, yValues, labelString):
    ## setup window
    root = Tk()
    root.wm_title("Graphed Projectile")

    ## setup frame
    frame = Frame(root)
    frame.pack()

    label = Label(root, text=labelString, font=("Verdana", 12))
    label.pack(pady=10, padx=10)

    f = Figure(figsize=(5, 5), dpi=100)
    a = f.add_subplot(111)
    a.plot(xValues, yValues)

    canvas = FigureCanvasTkAgg(f, root)
    canvas.show()
    canvas.get_tk_widget().pack(side=BOTTOM, fill=BOTH, expand=True)

    toolbar = NavigationToolbar2TkAgg(canvas, root)
    toolbar.update()
    canvas._tkcanvas.pack(side=TOP, fill=BOTH, expand=True)

    DataGrid(xValues, yValues)

    root.mainloop()
Ejemplo n.º 4
0
def _plot(self, x,y):
	root = Tk.Tk()
	root.wm_title("")


	f = Figure(figsize=(6,6), dpi=100)
	a = f.add_subplot(111)
	t = arange(0.0,3.0,0.01)
	s = sin(2*pi*t)

	a.plot(t,s)


	# a tk.DrawingArea
	canvas = FigureCanvasTkAgg(f, master=root)
	canvas.show()
	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 _quit():
    	root.quit()     # stops mainloop
    	root.destroy()  # this is necessary on Windows to prevent
                    # Fatal Python Error: PyEval_RestoreThread: NULL tstate

	button = Tk.Button(master=root, text='Quit', command=_quit)
	button.pack(side=Tk.BOTTOM)

	Tk.mainloop()
	# If you put root.destroy() here, it will cause an error if
	# the window is closed with the window manager.
Ejemplo n.º 5
0
    def graph_data(self):
        if bool(self.preferences_twoplot_var.get()) is False:
            f = Figure(figsize=(15,6), dpi=100,)
            self.graph = f.add_subplot(111)
            self.plot_data, = self.graph.plot(0,0)

            self.graph_canvas = FigureCanvasTkAgg(f, self)
            self.graph_canvas.show()
            self.graph_canvas.get_tk_widget().pack(side=BOTTOM,
                                                   fill=BOTH, expand=True)

            toolbar = NavigationToolbar2TkAgg(self.graph_canvas, self)
            toolbar.update()
            self.graph_canvas._tkcanvas.pack(side=TOP,
                                             fill=BOTH, expand=True)
        else:
            f = Figure(figsize=(15,6), dpi=100,)
            self.graph1 = f.add_subplot(211)
            self.graph2 = f.add_subplot(212)
            self.plot_data_1, = self.graph1.plot(0,0)
            self.plot_data_2, = self.graph2.plot(0,0)

            self.graph_canvas = FigureCanvasTkAgg(f, self)
            self.graph_canvas.show()
            self.graph_canvas.get_tk_widget().pack(side=BOTTOM,
                                                   fill=BOTH, expand=True)

            toolbar = NavigationToolbar2TkAgg(self.graph_canvas, self)
            toolbar.update()
            self.graph_canvas._tkcanvas.pack(side=TOP,
                                             fill=BOTH, expand=True)
        self.update_graph()
  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()

    button2 = tk.Button(self,text="Page One",
        command=lambda: controller.show_frame(PageOne))

    button2.pack()

    button3 = tk.Button(self,text="Page Two",
        command=lambda: controller.show_frame(PageTwo))

    button3.pack()

    canvas = FigureCanvasTkAgg(f, self)
    canvas.show()
    canvas.get_tk_widget().pack(side=tk.TOP,fill=tk.BOTH, expand = True)

    toolbar = NavigationToolbar2TkAgg(canvas, self)
    toolbar.update()
    canvas._tkcanvas.pack(side=tk.TOP,fill=tk.BOTH, expand = True)
Ejemplo n.º 7
0
def AmbientRecorder():
    global lastcanvas
    
    record.record(AMBIENT_FILENAME,1,RATE)
    data=wavfile.read(AMBIENT_FILENAME) [1]
    t = arange(len(data))*1.0/RATE
    f=Figure(figsize=(4,3),dpi=100)
    a=f.add_subplot(111)

    a.plot(t,data)
    a.set_title('Ambient recording')
    a.set_xlabel('Time')
    a.set_ylabel('Amplitude')

    #canvas.delete(Tk.ALL)
    canvas=FigureCanvasTkAgg(f,master=root)
    canvas.show()

    if lastcanvas!=None:
        lastcanvas.pack_forget()
    lastcanvas=canvas.get_tk_widget()
    lastcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)

    #canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)

    label.config(text="Please check the waveform for any unwanted noises. Record again?")
Ejemplo n.º 8
0
    def __init__(self, x, y):
        f = matplotlib.figure.Figure(figsize=(5, 4), dpi=100)
        # f = matplotlib.figure.Figure(dpi=100)
        ax = f.add_subplot(111)
        canvas = ax.figure.canvas

        line, = p.plot(x, y, animated=True, lw=2)

        canvas = FigureCanvasTkAgg(f, master=root)
        canvas.show()

        canvas.get_tk_widget().grid()

        toolbar = NavigationToolbar2TkAgg(canvas, root)
        toolbar.update()

        canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)

        p.subplots_adjust(left=-0.1, bottom=0.0)
        manager = p.get_current_fig_manager()
        manager.window.after(100, self.run)

        self.canvas = canvas
        self.ax = ax
        self.line = line
        self.x = x
        self.y = y
Ejemplo n.º 9
0
class Application(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.grid()
        self.master.title("Grid Manager")

        for r in range(6):
            self.master.rowconfigure(r, weight=1)    
        for c in range(5):
            self.master.columnconfigure(c, weight=1)
            Button(master, text="Button {0}".format(c)).grid(row=6,column=c,sticky=E+W)

        Frame1 = Frame(master, bg="red")
        Frame1.grid(row = 0, column = 0, rowspan = 3, columnspan = 2, sticky = W+E+N+S) 
        Frame2 = Frame(master, bg="blue")
        Frame2.grid(row = 3, column = 0, rowspan = 3, columnspan = 2, sticky = W+E+N+S)
        Frame3 = Frame(master, bg="green")
        Frame3.grid(row = 0, column = 2, rowspan = 6, columnspan = 3, sticky = W+E+N+S)

        self.fig = plt.figure(figsize=(10,10))
        # ax=fig.add_axes([0.1,0.1,0.8,0.8],polar=True)
        self.gs = GridSpec(3,1)
        ax = self.fig.add_subplot(self.gs[0:2,:])
        # self.im = ax.imshow(-np.random.random([128,128]), origin = 'upper', cmap=plt.cm.RdYlGn, interpolation = 'nearest', vmax=0, vmin=-400000)
        #
        self.canvas = FigureCanvasTkAgg(self.fig, master=Frame3)
        # self.canvas.show()
        # self.canvas.get_tk_widget().grid(side='top', fill='both', expand=1)
        self.canvas.get_tk_widget().grid()
Ejemplo n.º 10
0
class GraghFigure:
	def __init__(self, figFrame, figsizeX, figsizeY):

		self.fig = pylab.figure(dpi=fig_dpi, figsize=(figsizeX,figsizeY))
		self.canvas = FigureCanvasTkAgg(self.fig, master=figFrame)
		self.ax = self.fig.add_subplot(111)

		self.canvas.show()
		self.canvas.get_tk_widget().pack()
		self.ax.grid(True)
		self.line=[]
		self.line_num=-1

	def setAchse(self, xLabel, yLabel):
		self.xAchse=xAchse
		self.yAchse=yAchse
		self.ax.set_xlabel(xLabel)
		self.ax.set_ylabel(yLabel)

	def setAxis(self, x0,x1,y0,y1):
		self.ax.axis([x0,x1 ,y0,y1])

	def addplot(self, style):
		self.line.append(self.ax.plot(self.xAchse, self.yAchse, style, lw=3))
		#self.line = self.ax.plot(xAchse, yAchse, style)
		self.line_num = self.line_num + 1
		return self.line_num

	def plot(self, index, data_x, data_y):
		self.line[index][0].set_data(data_x, pylab.array(data_y))
Ejemplo n.º 11
0
class Window():
    def __init__(self, master):
        self.frame = tk.Frame(master)
        self.f = Figure(figsize=(10, 9), dpi=80)
        self.fig = plt.figure(1)
        #self.fig.patch.set_facecolor('black')

        t = np.arange(0.0,0.3,0.01)
        s = np.sin(np.pi*t)
        plt.plot(t,s)
        # self.ax0 = self.f.add_axes((0.05, .05, .50, .50), facecolor=(.75, .75, .75), frameon=False)
        # self.ax1 = self.f.add_axes((0.05, .55, .90, .45), facecolor=(.75, .75, .75), frameon=False)
        # self.ax2 = self.f.add_axes((0.55, .05, .50, .50), facecolor=(.75, .75, .75), frameon=False)
        #
        # self.ax0.set_xlabel('Time (s)')
        # self.ax0.set_ylabel('Frequency (Hz)')
        # self.ax0.plot(np.max(np.random.rand(100, 10) * 10, axis=1), "r-")
        # self.ax1.plot(np.max(np.random.rand(100, 10) * 10, axis=1), "g-")
        # self.ax2.pie(np.random.randn(10) * 100)

        self.frame = tk.Frame(root)
        self.frame.pack(side=tk.LEFT, fill=tk.BOTH, expand=1)

        self.canvas = FigureCanvasTkAgg(self.fig, master=self.frame)
        self.plot_widget = self.canvas.get_tk_widget()#.pack(side=tk.TOP, fill=tk.BOTH, expand=1)
        self.plot_widget.grid(row=0, column=0)
        #self.canvas.show()
        self.canvas.draw()
Ejemplo n.º 12
0
def viewdata():
	graph = Toplevel()
	global SampleNos
	global Temperature
	graph.wm_title("Downloaded Data")
	graph.wm_iconbitmap(bitmap = "@/home/pi/meter.xbm")
	menubar = Menu(graph)
	filemenu = Menu(menubar, tearoff=0)
	filemenu.add_command(label="Open", command=openl)
	filemenu.add_command(label="Save", command=hello)
	filemenu.add_separator()
	filemenu.add_command(label="Exit", command=root.quit)
	menubar.add_cascade(label="File", menu=filemenu)
	graph.config(menu=menubar)
	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(SampleNos,Temperature, 'bo')
	canvas = FigureCanvasTkAgg(f, master=graph)
	canvas.show()
	canvas.get_tk_widget().pack()
	toolbar = NavigationToolbar2TkAgg(canvas, graph)
	toolbar.update()
	canvas._tkcanvas.pack()
Ejemplo n.º 13
0
def drawFFTAndPath(frame, x, y, freq, amp, titleCoP, titleFFT):
    f = Figure()

    gs = gridspec.GridSpec(1,2,width_ratios=[1,1],height_ratios=[1,1])

    a = f.add_subplot(gs[0])
    img = imread("Images/Wii.JPG")
    a.imshow(img, zorder=0, extent=[-216 - 26, 216 + 26, -114 - 26, 114 + 26])
    a.plot(x, y)
    a.set_title(titleCoP, fontsize=13)
    a.set_xlim([-216 - 30, 216 + 30])
    a.set_ylim([-114 - 30, 114 + 30])
    a.set_ylim([-114 - 30, 114 + 30])
    a.set_xlabel("CoPx (mm)", fontsize=12)
    a.set_ylabel("CoPy (mm)", fontsize=12)

    if amp[0] == 0:
        titleFFT = titleFFT + ' (0Hz filtered)'
    b = f.add_subplot(gs[1])
    b.plot(freq, amp)
    ttl = b.title
    ttl.set_position([.5, 1.05])
    b.set_title(titleFFT, fontsize=12)
    b.set_xlabel("Frequency (Hz)", fontsize=12)
    b.set_ylabel("Amplitude", fontsize=12)

    canvas = FigureCanvasTkAgg(f, frame)
    toolbar = NavigationToolbar2TkAgg(canvas, frame)
    canvas.show()
    canvas.get_tk_widget().pack(side=BOTTOM, fill=BOTH, expand=True)
    toolbar.update()
    canvas._tkcanvas.pack(side=TOP, fill=BOTH, expand=True)
Ejemplo n.º 14
0
    def __init__(self, graph_frame, graph_config, graph_values):
        """
        graph_frame: tk frame to hold the graph_frame
        graph_config: configuration that was set from xml config parse
        graph_values: values that were generated as a result of graph config
        """ 
        self.logger = logging.getLogger('RT_Plot')
        self.logger.debug('__init__')


        # Create Line
        self.data_line = Line2D([],[])

        # Create plot
        self.plot_holder = Figure(figsize=(graph_values['x'], graph_values['y']), dpi=graph_values['dpi']) 
        self.rt_plot = self.plot_holder.add_subplot(111)
        self.rt_plot.add_line(self.data_line)
        
        # Set Title Configuration
        self.rt_plot.set_ylabel(graph_config['y_title']) 
        self.rt_plot.set_xlabel(graph_config['x_title']) 
        self.plot_holder.suptitle(graph_config['main_title'], fontsize=16)

        # Autoscale on unknown axis 
        self.rt_plot.set_autoscaley_on(True)
        self.rt_plot.set_autoscalex_on(True)
        # Set x limits?

        # Create canvas
        canvas = FigureCanvasTkAgg(self.plot_holder, master=graph_frame)
        canvas.show()
        # Attach canvas to graph frame
        canvas.get_tk_widget().grid(row=0, column=0)
Ejemplo n.º 15
0
def makeplottk(targetdata):
	from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
	from matplotlib.backend_bases import key_press_handler
	from matplotlib.figure import Figure
	for i in range(0,len(targetdata)):
		targetdata[i]['data'][0]=[(j-2400000) for j in targetdata[i]['data'][0]]
	numplots=len(targetdata)
#this is where its different thatn makeplot, we need to set up the tk enviornment etc
	root=Tk()
	root.wm_title(targetdata[0]['name'])
	f=Figure(figsize=(10,8))
	for i in range(0,numplots):
		a=f.add_subplot(numplots,1,i+1)
		a.plot(targetdata[i]['data'][0],targetdata[i]['data'][1], 'ro')
		a.axes.invert_yaxis()
		a.legend(targetdata[i]['flt'])
	canvas=FigureCanvasTkAgg(f, master=root)
	canvas.show()
	canvas.get_tk_widget().pack(side=TOP, fill=BOTH, expand=1)
#now to add the cool widget bar
	toolbar = NavigationToolbar2TkAgg( canvas, root )
	toolbar.update()
	canvas._tkcanvas.pack(side=TOP, fill=BOTH, expand=1)
	mainloop()
	return
Ejemplo n.º 16
0
def Video():
    image1 = video.read(0)[1]
    axis1.imshow(image1)
    canvas1 = FigureCanvasTkAgg(videoFigure, master=window)
    canvas1.show()
    canvas1.get_tk_widget().pack(side=Tk.LEFT, fill=Tk.BOTH, expand=1)
    canvas1._tkcanvas.pack(side=Tk.LEFT, fill=Tk.BOTH, expand=1)
Ejemplo n.º 17
0
    def __init__(self, parent, controller):

        tk.Frame.__init__(self, parent)

        label = tk.Label(self, text="Page three")
        label.pack(padx=10, pady=10)

        button = ttk.Button(self, text="Home",
                command=lambda: controller.show_frame(StartPage))
        button.pack()

        # Data to plot
        #f = Figure(figsize=(5, 5), dpi=100)
        #a = f.add_subplot(111)
        #a.plot([0,1,2,3,4,5,6,7,8], [0,2,7,3,5,1,7,8,2])

        # Create a simple canvas
        canvas = FigureCanvasTkAgg(f, self)
        canvas.show()
        canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=True)

        # Navigation bar
        toolbar = NavigationToolbar2TkAgg(canvas, self)
        toolbar.update()
        canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
Ejemplo n.º 18
0
class Preview(tk.Frame):
    #def __init__(self, parent, dim, dpi=36, label=None):
    def __init__(self, parent, dim, dpi=36, label=None, col=0, row=0):
        tk.Frame.__init__(self, parent)
        self.dim = dim
        self.bg = np.zeros((int(dim), int(dim)), float)
        ddim = dim/dpi
        self.figure = Figure(figsize=(ddim, ddim), dpi=dpi, frameon=False)
        self.canvas = FigureCanvasTkAgg(self.figure, master=self)
        self.canvas.get_tk_widget().grid(column=0, row=0)#, sticky=(N, W, E, S))
        if label:
            tk.Label(self, text=label).grid(column=0, row=1)
        self._createAxes()
        
    def setWindowTitle(self,title):
        """ Set window title"""
        self.canvas.set_window_title(title)

    def _createAxes(self):
        """ Should be implemented in subclasses. """
        pass
    
    def _update(self):
        """ Should be implemented in subclasses. """
        pass
    
    def clear(self):
        self._update(self.bg)
        
    def updateData(self, Z):
        self.clear()
        self._update(Z)
Ejemplo n.º 19
0
class Application(tk.Frame):
    def __init__(self, master=None):
        matplotlib.use('TkAgg')
        tk.Frame.__init__(self, master)
        self.pack()
        self.createWidgets()



    def createWidgets(self):

        self.fig = Figure(figsize=(5,4), dpi=100)
        self.canvas = FigureCanvasTkAgg(self.fig, self)
        self.canvas.show()
        self.canvas.get_tk_widget().grid(row=0, columnspan=3)
        sim = Simulator.Simulator.Simulator(self.fig, self.canvas)
        # sim.run()
        self.timer = Periodic(0.3, sim.run)
        self.timer.start()



        self.QUIT = tk.Button(self, text="QUIT", fg="red",
                                            command=root.destroy)
        self.QUIT.grid(row=2)
Ejemplo n.º 20
0
    def insert_frame(self, name, parent_frame_name, idx, frame_type=None, **kwargs):
        parent_frame = self.frames[parent_frame_name]
        frame = Frame(parent_frame)

        # add frame to list of frames
        self.frames[name] = frame

        # pre-fill the frame
        if frame_type is None:
            pass
        elif frame_type == 'plot':
            # generate canvas
            dim = kwargs['shape']
            f = Figure(figsize=dim, dpi=113  )
            a = f.add_subplot(111)
            canvas = FigureCanvasTkAgg(f, master=frame)
            
            # Commit the canvas to the gui
            canvas.get_tk_widget().pack()

            # save canvas data for later access
            self.mpl_data[name] = {}
            self.frame_data['plot'] = {'mpl_canvas':canvas}

        # commit the frame to workspace
        frame.grid(row=idx[0], column=idx[1])
Ejemplo n.º 21
0
class PlotClass:
    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 make_erg_plot(self,kegelst):
        self.plot1 = self.figure.add_subplot(111)
        self.plot1.set_title("Kegelstumpf Abwicklung")

        self.plot1.hold(True)

        for geo in kegelst.geo:
            geo.plot2plot(self.plot1)
Ejemplo n.º 22
0
    def __init__(self, parent, controller):
        time.sleep(2)
        tk.Frame.__init__(self, parent)
        label = tk.Label(self, text='Before we begin, lets have a quick tutorial! \n\n'
               'This simulation is designed to mimic that of the decline in real life, which is effecting us in ways '
               'we can\'t understand today...\n ', font=LARGE_FONT)
        label.pack(pady=10, padx=10)

        f = Figure(figsize=(10,5), dpi=100)
        a = f.add_subplot(111)
        a.plot([1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960,
                1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976,
                1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992,
                1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
                2009, 2010],
               [5500000, 5500000, 5430000, 5420000, 5425032, 5433200, 5503020, 5500030,
                5435476, 5365343, 5322342, 5433454, 5762638, 5626379, 5533450, 5505032,
                5325374, 5229382, 5332534, 5442435, 5632436, 5225356, 5354252, 5543344,
                5544345, 5533453, 5433453, 5335344, 5345473, 5222223, 5199872, 5203002,
                5102293, 5100330, 5093929, 5022332, 4999221, 4922322, 4822828, 4789800,
                4733723, 4636364, 4444323, 4478779, 4422302, 4122321, 3999212, 4002293,
                3888182, 3772373, 3642069, 3444333, 3220032, 3002230, 2883292, 2992283,
                3322332, 3441422, 3322332, 2993828, 2777283, 2633543, 2339862, 2122039,
                2100293, 2003993], 'g')

        title = "Bee Population Decline Since 1945 (Bee Hives In Millions)"
        a.set_title(title)

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

        button1 = tk.Button(self, text="Next", command=lambda:controller.show_frame(TutorialThree))
        button1.pack()
Ejemplo n.º 23
0
 def attach_figure(figure, frame):
     canvas = FigureCanvasTkAgg(figure, master=frame)  # 内嵌散点图到UI
     canvas.show()
     canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
     toolbar = NavigationToolbar2TkAgg(canvas, frame)  # 内嵌散点图工具栏到UI
     toolbar.update()
     canvas.tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
Ejemplo n.º 24
0
 def __init__(self, parent, controller):
     tk.Frame.__init__(self, parent)
     
     canvas = FigureCanvasTkAgg(f, self)
     canvas.show()
     canvas.get_tk_widget().pack(side=tk.BOTTOM, fill=tk.BOTH, expand=True)
     canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
def graphic(): 
  appears = varien*boltzmann*6e3
  f = plt.figure(figsize=(20,20))
  gs = plt.GridSpec(3, 2)
  mean1, o1, comp1 = analysis(snowblind, varien, "good", 0, gs)
  mean2, o2, comp2 = analysis(snowblind, appears, "month", 1, gs)
  burn = Tk()
  def another():
    burn.destroy()
  def andother():
    burn.destroy()
    sys.exit()
  burn.protocol('WM_DELETE_WINDOW', andother)
  burn.wm_title("Stadistic")
  canvas = FigureCanvasTkAgg(f, master = burn)
  toolbar = NavigationToolbar2TkAgg(canvas, burn)
  L1 = Label(burn, text="Your Mean is %s %s and your Mean Deviation is %s %s"%(str(mean1), str(comp1), str(o1), str(comp1)))
  L2 = Label(burn, text="Your Mean is %s %s and your Mean Deviation is %s %s"%(str(mean2), str(comp2), str(o2), str(comp2)))
  L3 = Label(burn, text="Your observation started in %s and finished in %s %s (UT) "%(timein, timeout, mirai[0]))
  B1 = Button(burn, text="Quit", bg="red", fg="white" ,command=andother)
  B2 = Button(burn, text="Another File", bg="blue", fg="white", command=another)
  L1.grid(columnspan=2)
  L2.grid(columnspan=2)
  L3.grid(columnspan=2)
  burn.grid_columnconfigure(1, weight=1)
  B1.grid(row=3, sticky=E)
  B2.grid(row=3, column=1, sticky=W)
  burn.grid_columnconfigure(0, weight=1)
  burn.grid_rowconfigure(4, weight=1)
  canvas.get_tk_widget().grid(row=4, columnspan=2, sticky=W)
  toolbar.grid(columnspan=2)
  burn.mainloop()
Ejemplo n.º 26
0
	def plotBERcurve(self):
		row = 0
		berCurveFrame = Tk.Frame(root, borderwidth=2, relief="raised", pady= 15, padx=10)
		berCurveFrame.grid(row = row, column = 4, rowspan = 9, columnspan = 2, sticky = (Tk.N, Tk.W, Tk.E, Tk.S))

		self.calculate = Tk.IntVar()
		self.calculate.set(0)
		calculate = Tk.Checkbutton(berCurveFrame, text="  Calculate", font=("Helvetica", 12), variable = self.calculate).grid(row = 2, column = 21, columnspan = 2, sticky=(Tk.W, Tk.E))

		self.hold = Tk.IntVar()
		self.hold.set(0)
		hold = Tk.Checkbutton(berCurveFrame, text="Hold", font=("Helvetica", 12), variable = self.hold).grid(row = 3, column = 21, columnspan = 2, sticky=(Tk.W, Tk.E))

		f = Figure(figsize=(4.5, 4.5), dpi=100)
		a = f.add_subplot(111)
		t = (1, 2, 3, 4)
		s = (1, 2, 3, 4)
		canvas = FigureCanvasTkAgg(f, berCurveFrame)
		canvas.show()
		canvas.get_tk_widget().grid(row= 1,column = 0,rowspan = 6, columnspan = 6, sticky = (Tk.N, Tk.W, Tk.E, Tk.S))
		a.plot(t, s)
		a.set_title('BER Curve')
		a.set_xlabel('Eb/Nq')
		a.set_ylabel('BER')

		save = Tk.Button(berCurveFrame, text="Save", command = lambda: self.savePlotBER(f), bg = "cyan").grid(row=4, column = 21, columnspan = 2, padx = 15, sticky=(Tk.W, Tk.E))

		clear = Tk.Button(berCurveFrame, text="Clear", command = lambda: self.clearPlot(f), bg = "cyan").grid(row=5, column = 21, columnspan = 2, padx = 15, sticky=(Tk.W, Tk.E))	
Ejemplo n.º 27
0
    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)

        #add a button to navigate to a different page
        button1 = ttk.Button(self, text='Back to Home', 
                            command=lambda: controller.show_frame(StartPage))
        #lambda creates a function on the fly so you can pass parameters
        button1.pack()

        f = Figure(figsize=(5,5), dpi=100)
        a = f.add_subplot(111)
        a.plot([1,2,3,4,5,6,7,8],[5,6,1,3,8,9,3,5])

        

        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)
Ejemplo n.º 28
0
class Plotter:
    
    __fig = 1
    __splot = 1
    __canvas = 1
    __toolbar = 1

    def __init__(self,tk_root):
        self.__fig = Figure(figsize=(5,5), dpi=100);
        self.__splot = self.__fig.add_subplot(111)
        self.__splot.grid()

        self.__canvas = FigureCanvasTkAgg(self.__fig, master=tk_root)
        self.__canvas.show()
        self.__canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=1)
    
        self.__toolbar = NavigationToolbar2TkAgg(self.__canvas, tk_root)
        self.__toolbar.update()
        self.__canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=1)

    def add_to_plot(self,x,y,legend):
        self.__splot.plot(x,y,'.-',label=legend)
        self.__splot.legend()
        self.__canvas.draw()

    def plot_hist(self,data,bins):
        self.__splot.hist(data,bins)
        self.__canvas.draw()
    def plot(self,x,y):
        self.__splot.clear();
        self.__splot.grid()
        self.__splot.plot(x,y)
        self.__canvas.draw()
class App():
    def __init__(self):
        self.root = tk.Tk()
        self.root.wm_title("Embedding in TK")

        self.fig = plt.figure()
        self.ax = self.fig.add_subplot(111, projection='3d')
        self.ax.set_xlabel('X')
        self.ax.set_ylabel('Y')
        self.fig = function1(self.fig, self.ax)

        self.canvas = FigureCanvasTkAgg(self.fig, master=self.root)
        self.toolbar = NavigationToolbar2TkAgg( self.canvas, self.root )
        self.toolbar.update()
        self.canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=1)

        self.label = tk.Label(text="")
        self.label.pack()
        self.update_clock()
        self.root.mainloop()

    def update_clock(self):
        self.fig = function1(self.fig,self.ax)
        self.canvas.show()
        self.canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=1)
        now = time.strftime("%H:%M:%S")
        self.label.configure(text=now)
        self.root.after(1000, self.update_clock)
Ejemplo n.º 30
0
class TriGUI:

	def __init__(self,root,canvas_width,canvas_height):
		self.root=root
		self.canvas_width = canvas_width
		self.canvas_height = canvas_height

		self.moduli_space = {'vertices':np.array([[0.,0.],[1.,0.],[0.5,np.sqrt(3.)/2.]]),'triangles':[0,1,2]}

		self.fig, self.ax = mpl.pyplot.subplots()
		self.ax.clear()
		self.ax.autoscale(enable=False)
		self.ax.axis('off')
		self.canvas = FigureCanvasTkAgg(self.fig,master=root)
		self.canvas.show()
		self.canvas.get_tk_widget().pack()

		X = self.moduli_space['vertices'][:,0]
		Y = self.moduli_space['vertices'][:,1]
		outline = tri.Triangulation(X,Y)
		self.ax.triplot(outline)

		#self.canvas.mpl_connect("button_press_event", self.setVertex)

	def quite(self):
		self.root.destroy()
Ejemplo n.º 31
0
                  font=("Arial", 14),
                  bg="Blue",
                  fg="black",
                  command=printdiag)
btnPrint.place(x=100, y=57, anchor=CENTER)

Data2 = {
    'Time': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    'Temp': [9.8, 12, 8, 7.2, 6.9, 7, 6.5, 6.2, 5.5, 6.3]
}

df2 = DataFrame(Data2, columns=['Time', 'Temp'])
df2 = df2[['Time', 'Temp']].groupby('Time').sum()
fig = plt.Figure(figsize=(5, 4), dpi=80)
ax1 = fig.add_subplot(1, 1, 1)
line2 = FigureCanvasTkAgg(fig, f8)
line2.get_tk_widget().place(x=60, y=80)
ax1.set_title('CPU Tempurature')

btnCPUTemp = Button(f8,
                    text="CPU Temp",
                    font=("Arial", 12),
                    bg="Green",
                    fg="black",
                    command=snmpget)
btnCPUTemp.place(x=550, y=280, anchor=CENTER)

btnCPUTemp = Button(f8,
                    text="Show Gragh",
                    font=("Arial", 12),
                    bg="Green",
Ejemplo n.º 32
0
    def __init__(self, parent, controller):
        def lightWrite():
            global lightMFlag
            if (light_text.get() == " Turn Light On  "):
                light_text.set("Turn Light Auto")
                lightMFlag = True

            elif (light_text.get() == "Turn Light Auto"):
                light_text.set(" Turn Light On  ")
                lightMFlag = False

        def heatWrite():
            global heatMFlag
            if (heat_text.get() == "Turn Heat On  "):
                heat_text.set("Turn Heat Auto")
                heatMFlag = True

            elif (heat_text.get() == "Turn Heat Auto"):
                heat_text.set("Turn Heat On  ")
                heatMFlag = False

        def fanWrite():
            global fanMFlag
            if (fan_text.get() == "Turn Fan On  "):
                fan_text.set("Turn Fan Auto")
                fanMFlag = True

            elif (fan_text.get() == "Turn Fan Auto"):
                fan_text.set("Turn Fan On  ")
                fanMFlag = False

        def w0Write():
            global w0MFlag
            if (w0_text.get() == "Water Plot 1 On"):
                w0_text.set("Water Plot 1 Auto")
                w0MFlag = True

            elif (w0_text.get() == "Water Plot 1 Auto"):
                w0_text.set("Water Plot 1 On")
                w0MFlag = False

        def w1Write():
            global w1MFlag
            if (w1_text.get() == "Water Plot 2 On"):
                w1_text.set("Water Plot 2 Auto")
                w1MFlag = True

            elif (w1_text.get() == "Water Plot 2 Auto"):
                w1_text.set("Water Plot 2 On")
                w1MFlag = False

        def w2Write():
            global w2MFlag
            if (w2_text.get() == "Water Plot 3 On"):
                w2_text.set("Water Plot 3 Auto")
                w2MFlag = True

            elif (w2_text.get() == "Water Plot 3 Auto"):
                w2_text.set("Water Plot 3 On")
                w2MFlag = False

        def w3Write():
            global w3MFlag
            if (w3_text.get() == "Water Plot 4 On"):
                w3_text.set("Water Plot 4 Auto")
                w3MFlag = True

            elif (w3_text.get() == "Water Plot 4 Auto"):
                w3_text.set("Water Plot 4 On")
                w3MFlag = False

        tk.Frame.__init__(self, parent)

        button2 = ttk.Button(self,
                             text="Camera",
                             command=lambda: controller.show_frame(PageOne, 0))
        button2.grid(row=4, column=0)

        light_text = StringVar()
        lightButton = ttk.Button(self,
                                 textvariable=light_text,
                                 command=lightWrite)
        light_text.set(" Turn Light On  ")
        lightButton.grid(row=5, column=0)

        fan_text = StringVar()
        fanButton = ttk.Button(self, textvariable=fan_text, command=fanWrite)
        fan_text.set("Turn Fan On  ")
        fanButton.grid(row=6, column=0)

        heat_text = StringVar()
        heatButton = ttk.Button(self,
                                textvariable=heat_text,
                                command=heatWrite)
        heat_text.set("Turn Heat On  ")
        heatButton.grid(row=7, column=0)

        variable1 = StringVar()
        variable1.set(OPTIONS[0])  # default value
        variable2 = StringVar()
        variable2.set(OPTIONS[0])  # default value
        variable3 = StringVar()
        variable3.set(OPTIONS[0])  # default value
        variable4 = StringVar()
        variable4.set(OPTIONS[0])  # default value

        label1 = tk.Label(self, text="Plot 1", font=LARGE_FONT)
        label1.grid(row=0, column=1)
        option1 = OptionMenu(self,
                             variable1,
                             *OPTIONS,
                             command=self.switchPlot1)
        option1.grid(row=1, column=1)

        label2 = tk.Label(self, text="Plot 2", font=LARGE_FONT)
        label2.grid(row=0, column=2)
        option2 = OptionMenu(self,
                             variable2,
                             *OPTIONS,
                             command=self.switchPlot2)
        option2.grid(row=1, column=2)

        label3 = tk.Label(self, text="Plot 3", font=LARGE_FONT)
        label3.grid(row=2, column=1)
        option3 = OptionMenu(self,
                             variable3,
                             *OPTIONS,
                             command=self.switchPlot3)
        option3.grid(row=3, column=1)

        label4 = tk.Label(self, text="Plot 4", font=LARGE_FONT)
        label4.grid(row=2, column=2)
        option4 = OptionMenu(self,
                             variable4,
                             *OPTIONS,
                             command=self.switchPlot4)
        option4.grid(row=3, column=2)

        w0_text = StringVar()
        w0Button = ttk.Button(self, textvariable=w0_text, command=w0Write)
        w0_text.set("Water Plot 1 On")
        w0Button.grid(row=0, column=3)

        w1_text = StringVar()
        w1Button = ttk.Button(self, textvariable=w1_text, command=w1Write)
        w1_text.set("Water Plot 2 On")
        w1Button.grid(row=1, column=3)

        w2_text = StringVar()
        w2Button = ttk.Button(self, textvariable=w2_text, command=w2Write)
        w2_text.set("Water Plot 3 On")
        w2Button.grid(row=2, column=3)

        w3_text = StringVar()
        w3Button = ttk.Button(self, textvariable=w3_text, command=w3Write)
        w3_text.set("Water Plot 4 On")
        w3Button.grid(row=3, column=3)

        canvas = FigureCanvasTkAgg(f, self)
        canvas.show()

        canvas.get_tk_widget().grid(row=4, column=1, columnspan=3, rowspan=4)
Ejemplo n.º 33
0
    def graph_widgets(self):
        self.canvas = tk.Canvas(self.graph)

        self.figure = Figure(figsize=(5.6, 4), dpi=100)
        self.can = FigureCanvasTkAgg(self.figure, self.canvas)
        self.can.get_tk_widget().grid(row=0, column=0, padx=10)
Ejemplo n.º 34
0
class Application(tk.Frame):
    def __init__(self, master=None):
        super().__init__(master)
        self.master = master
        self.pack()

        self.var = tk.StringVar()
        self.plot_type = 'bar'
        self.plot_active = True

        self.create_frames()
        self.update_widgets()
        self.chart_type_widgets()
        self.searchbar_widgets()
        self.controls_widgets()
        self.graph_widgets()

        self.master.bind('<Return>', self.searchData)

    def create_frames(self):
        self.updates = tk.LabelFrame(self,
                                     text='Updates',
                                     font=("times new roman", 15, "bold"),
                                     bg="slate gray",
                                     fg="white",
                                     bd=5,
                                     relief=tk.GROOVE)
        self.updates.config(width=700, height=100)
        self.updates.grid(row=0, column=0, columnspan=5)

        self.chart_type = tk.LabelFrame(self,
                                        text='',
                                        font=("times new roman", 15, "bold"),
                                        bg="white",
                                        fg="white",
                                        bd=0)
        self.chart_type.config(width=190, height=50)
        self.chart_type.grid(row=1, column=0, pady=5)

        self.searchbar = tk.LabelFrame(self,
                                       text='',
                                       font=("times new roman", 15, "bold"),
                                       bg="white",
                                       fg="white")
        self.searchbar.config(width=500, height=70)
        self.searchbar.grid(row=1, column=1, pady=5, columnspan=5)

        self.controls = tk.LabelFrame(self,
                                      text='',
                                      font=("times new roman", 15, "bold"),
                                      bg="salmon1",
                                      fg="white",
                                      bd=5)
        self.controls.config(width=190, height=405)
        self.controls.grid(row=2, column=0, pady=10, rowspan=2)

        self.graph = tk.LabelFrame(self,
                                   text='',
                                   font=("times new roman", 15, "bold"),
                                   bg="white",
                                   fg="white",
                                   bd=5,
                                   relief=tk.GROOVE)
        self.graph.config(width=260, height=400)
        self.graph.grid(row=2, column=1, columnspan=5, padx=10)

    def update_widgets(self):
        self.total = tk.Label(self.updates,
                              font=("times new roman", 16, "bold"),
                              bg="brown2",
                              fg="white")
        self.total.config(width=11, height=2, padx=2)
        self.total.grid(row=0, column=0)

        self.active = tk.Label(self.updates,
                               font=("times new roman", 16, "bold"),
                               bg="dodger blue",
                               fg="white")
        self.active.config(width=11, height=2, padx=5)
        self.active.grid(row=0, column=1)

        self.recovered = tk.Label(self.updates,
                                  font=("times new roman", 16, "bold"),
                                  bg="forest green",
                                  fg="white")
        self.recovered.config(width=11, height=2, padx=5)
        self.recovered.grid(row=0, column=2)

        self.deaths = tk.Label(self.updates,
                               font=("times new roman", 16, "bold"),
                               bg="red3",
                               fg="white")
        self.deaths.config(width=11, height=2, padx=5)
        self.deaths.grid(row=0, column=3)

        self.todays = tk.Label(self.updates,
                               font=("times new roman", 16, "bold"),
                               bg="DarkOrange2",
                               fg="white")
        self.todays.config(width=12, height=2, padx=8)
        self.todays.grid(row=0, column=4)

        self.get_world_info()

    def chart_type_widgets(self):
        self.bar = tk.Button(self.chart_type, bg='blue', fg='white', font=10)
        self.bar['text'] = 'Bar'
        self.bar['command'] = self.bar_chart
        self.bar.config(width=5, height=1)
        self.bar.grid(row=0, column=0, pady=4, padx=15)

        self.pie = tk.Button(self.chart_type, bg='green', fg='white', font=10)
        self.pie['text'] = 'Pie'
        self.pie['command'] = self.pie_chart
        self.pie.config(width=5, height=1)
        self.pie.grid(row=0, column=1, pady=4, padx=15)

    def searchbar_widgets(self):
        self.searchtext = tk.Label(self.searchbar,
                                   text='Country name',
                                   font=("times new roman", 10, "bold"))
        self.searchtext.grid(row=0, column=0)
        self.cname = tk.Entry(self.searchbar)
        self.cname['textvariable'] = self.var
        self.cname.config(width=40)
        self.cname.grid(row=0, column=1, padx=(5, 25))

        self.search = tk.Button(self.searchbar,
                                bg='green',
                                fg='white',
                                font=10)
        self.search['text'] = 'Search'
        self.search['command'] = self.searchData
        self.search.config(width=12)
        self.search.grid(row=0, column=2, padx=(0, 5))

    def controls_widgets(self):
        self.info = tk.Label(self.controls, image=virus)
        self.info.grid(row=0, column=0, pady=8, columnspan=2)

        self.date = tk.Label(self.controls,
                             font=("times new roman", 16, "bold"),
                             bg="salmon1",
                             fg="white")
        self.date['text'] = f'Covid-19 \n Stats Tracker \n {todays_date()}'
        self.date.config(width=12, height=3, padx=12)
        self.date.grid(row=1, column=0, columnspan=2)

        self.refresh = tk.Button(self.controls,
                                 bg='green',
                                 fg='white',
                                 font=10)
        self.refresh['text'] = 'Refresh'
        self.refresh['command'] = self.refresh_stats
        self.refresh.config(width=12, height=1)
        self.refresh.grid(row=2, column=0, pady=8, columnspan=2)

        self.world = tk.Button(self.controls, bg='green', fg='white', font=10)
        self.world['text'] = 'World'
        self.world['command'] = self.get_world_info
        self.world.config(width=12, height=1)
        self.world.grid(row=3, column=0, pady=8, columnspan=2)

        self.top10 = tk.Button(self.controls, bg='green', fg='white', font=10)
        self.top10['text'] = 'Top 10'
        self.top10['command'] = self.top_ten_countries
        self.top10.config(width=12, height=1)
        self.top10.grid(row=4, column=0, pady=8, columnspan=2)

    def graph_widgets(self):
        self.canvas = tk.Canvas(self.graph)

        self.figure = Figure(figsize=(5.6, 4), dpi=100)
        self.can = FigureCanvasTkAgg(self.figure, self.canvas)
        self.can.get_tk_widget().grid(row=0, column=0, padx=10)

    def change_label_data(self):
        self.total['text'] = f'Total Cases\n {self.data[0]}'
        self.active['text'] = f'Active \n {self.data[1]}'
        self.recovered['text'] = f'Recovered \n {self.data[2]}'
        self.deaths['text'] = f'Deaths \n {self.data[3]}'
        self.todays['text'] = f'Today \n {self.data[4]}'

    def get_world_info(self):
        self.data = get_world()
        self.var.set('')
        self.change_label_data()
        self.plot_graph(self.plot_type)

    def searchData(self, event=None):
        self.value = self.var.get()
        if self.value == '':
            print('Enter country name first')
        else:
            if self.value.upper() in ['USA', 'UK', 'UAE', 'CAR']:
                self.data = get_country(self.value.upper())
            else:
                self.data = get_country(self.value.capitalize())
            if self.data is not None:
                self.change_label_data()
                self.plot_graph(self.plot_type)

    def refresh_stats(self):
        ret = scrape_data()
        if ret is None:
            messagebox.showerror('no internet', 'No internet connection')
        else:
            read_stats_file()
            self.get_world_info()

    def top_ten_countries(self):
        self.data, self.table = top10()
        self.var.set('')
        self.change_label_data()
        self.create_table()

    def plot_graph(self, plt_type):
        if self.plot_active is False:
            self.delete_graph()
            self.plot_active = True
            cname = 'Top 10 Countries'
        else:
            if self.var.get() == '':
                cname = 'World'
            else:
                cname = self.var.get()
        self.figure = get_plot(self.data, cname, plt_type)

        self.can = FigureCanvasTkAgg(self.figure, self.graph)
        self.can.get_tk_widget().grid(row=0, column=0, padx=10)

    def bar_chart(self):
        self.plot_type = 'bar'
        self.bar['bg'] = 'blue'
        self.pie['bg'] = 'green'
        self.plot_graph(self.plot_type)

    def pie_chart(self):
        self.plot_type = 'pie'
        self.pie['bg'] = 'blue'
        self.bar['bg'] = 'green'
        self.plot_graph(self.plot_type)

    def create_table(self):
        self.delete_graph()
        self.plot_active = False

        total_rows, total_columns = len(self.table), len(self.table[0])
        for i in range(total_rows):
            for j in range(total_columns):
                self.e = tk.Text(self.graph)
                if i == 0:
                    self.e['fg'] = 'brown'
                    self.e['font'] = ('Arial', 10, 'bold')
                else:
                    self.e['fg'] = 'blue'
                    self.e['font'] = ('Arial', 9, 'bold')
                self.e.config(width=10, height=2)
                self.e.grid(row=i, column=j)
                self.e.insert(tk.END, self.table[i][j])

    def delete_graph(self):
        self.graph.destroy()
        self.graph = tk.LabelFrame(self,
                                   text='',
                                   font=("times new roman", 15, "bold"),
                                   bg="white",
                                   fg="white",
                                   bd=5,
                                   relief=tk.GROOVE)
        self.graph.config(width=260, height=400)
        self.graph.grid(row=2, column=1, columnspan=5, padx=10)
Ejemplo n.º 35
0
class MeshPlotter(tk.Frame):
    def __init__(self, parent, filename):
        tk.Frame.__init__(self, parent)

        self.labels = {
            'cell': 'Cell:',
            'cellborn': 'Cell born:',
            'surface': 'Surface:',
            'material': 'Material:',
            'universe': 'Universe:',
            'energyin': 'Energy in:',
            'energyout': 'Energy out:'
        }

        self.filterBoxes = {}

        # Read data from source or leakage fraction file
        self.get_file_data(filename)

        # Set up top-level window
        top = self.winfo_toplevel()
        top.title('Mesh Tally Plotter: ' + filename)
        top.rowconfigure(0, weight=1)
        top.columnconfigure(0, weight=1)
        self.grid(sticky=tk.W + tk.N)

        # Create widgets and draw to screen
        self.create_widgets()
        self.update()

    def create_widgets(self):
        figureFrame = tk.Frame(self)
        figureFrame.grid(row=0, column=0)

        # Create the Figure and Canvas
        self.dpi = 100
        self.fig = Figure((5.0, 5.0), dpi=self.dpi)
        self.canvas = FigureCanvasTkAgg(self.fig, master=figureFrame)
        self.canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=1)

        # Create the navigation toolbar, tied to the canvas
        self.mpl_toolbar = NavigationToolbar2TkAgg(self.canvas, figureFrame)
        self.mpl_toolbar.update()
        self.canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=1)

        # Create frame for comboboxes
        self.selectFrame = tk.Frame(self)
        self.selectFrame.grid(row=1, column=0, sticky=tk.W + tk.E)

        # Tally selection
        labelTally = tk.Label(self.selectFrame, text='Tally:')
        labelTally.grid(row=0, column=0, sticky=tk.W)
        self.tallyBox = ttk.Combobox(self.selectFrame, state='readonly')
        self.tallyBox['values'] = [
            self.datafile.tallies[i].id for i in self.meshTallies
        ]
        self.tallyBox.current(0)
        self.tallyBox.grid(row=0, column=1, sticky=tk.W + tk.E)
        self.tallyBox.bind('<<ComboboxSelected>>', self.update)

        # Planar basis selection
        labelBasis = tk.Label(self.selectFrame, text='Basis:')
        labelBasis.grid(row=1, column=0, sticky=tk.W)
        self.basisBox = ttk.Combobox(self.selectFrame, state='readonly')
        self.basisBox['values'] = ('xy', 'yz', 'xz')
        self.basisBox.current(0)
        self.basisBox.grid(row=1, column=1, sticky=tk.W + tk.E)
        self.basisBox.bind('<<ComboboxSelected>>', self.update)

        # Axial level
        labelAxial = tk.Label(self.selectFrame, text='Axial level:')
        labelAxial.grid(row=2, column=0, sticky=tk.W)
        self.axialBox = ttk.Combobox(self.selectFrame, state='readonly')
        self.axialBox.grid(row=2, column=1, sticky=tk.W + tk.E)
        self.axialBox.bind('<<ComboboxSelected>>', self.redraw)

        # Option for mean/uncertainty
        labelMean = tk.Label(self.selectFrame, text='Mean/Uncertainty:')
        labelMean.grid(row=3, column=0, sticky=tk.W)
        self.meanBox = ttk.Combobox(self.selectFrame, state='readonly')
        self.meanBox['values'] = ('Mean', 'Absolute uncertainty',
                                  'Relative uncertainty')
        self.meanBox.current(0)
        self.meanBox.grid(row=3, column=1, sticky=tk.W + tk.E)
        self.meanBox.bind('<<ComboboxSelected>>', self.update)

        # Scores
        labelScore = tk.Label(self.selectFrame, text='Score:')
        labelScore.grid(row=4, column=0, sticky=tk.W)
        self.scoreBox = ttk.Combobox(self.selectFrame, state='readonly')
        self.scoreBox.grid(row=4, column=1, sticky=tk.W + tk.E)
        self.scoreBox.bind('<<ComboboxSelected>>', self.redraw)

        # Filter label
        boldfont = font.Font(weight='bold')
        labelFilters = tk.Label(self.selectFrame,
                                text='Filters:',
                                font=boldfont)
        labelFilters.grid(row=5, column=0, sticky=tk.W)

    def update(self, event=None):
        if not event:
            widget = None
        else:
            widget = event.widget

        tally_id = self.meshTallies[self.tallyBox.current()]
        selectedTally = self.datafile.tallies[tally_id]

        # Get mesh for selected tally
        self.mesh = self.datafile.meshes[selectedTally.filters['mesh'].bins[0]
                                         - 1]

        # Get mesh dimensions
        self.nx, self.ny, self.nz = self.mesh.dimension

        # Repopulate comboboxes baesd on current basis selection
        text = self.basisBox['values'][self.basisBox.current()]
        if text == 'xy':
            self.axialBox['values'] = [str(i + 1) for i in range(self.nz)]
        elif text == 'yz':
            self.axialBox['values'] = [str(i + 1) for i in range(self.nx)]
        else:
            self.axialBox['values'] = [str(i + 1) for i in range(self.ny)]
        self.axialBox.current(0)

        # If update() was called by a change in the basis combobox, we don't
        # need to repopulate the filters
        if widget == self.basisBox:
            self.redraw()
            return

        # Update scores
        self.scoreBox['values'] = selectedTally.scores
        self.scoreBox.current(0)

        # Remove any filter labels/comboboxes that exist
        for row in range(6, self.selectFrame.grid_size()[1]):
            for w in self.selectFrame.grid_slaves(row=row):
                w.grid_forget()
                w.destroy()

        # create a label/combobox for each filter in selected tally
        count = 0
        for filterType in selectedTally.filters:
            if filterType == 'mesh':
                continue
            count += 1

            # Create label and combobox for this filter
            label = tk.Label(self.selectFrame, text=self.labels[filterType])
            label.grid(row=count + 6, column=0, sticky=tk.W)
            combobox = ttk.Combobox(self.selectFrame, state='readonly')
            self.filterBoxes[filterType] = combobox

            # Set combobox items
            f = selectedTally.filters[filterType]
            if filterType in ['energyin', 'energyout']:
                combobox['values'] = [
                    '{0} to {1}'.format(*f.bins[i:i + 2])
                    for i in range(f.length)
                ]
            else:
                combobox['values'] = [str(i) for i in f.bins]

            combobox.current(0)
            combobox.grid(row=count + 6, column=1, sticky=tk.W + tk.E)
            combobox.bind('<<ComboboxSelected>>', self.redraw)

        # If There are no filters, leave a 'None available' message
        if count == 0:
            count += 1
            label = tk.Label(self.selectFrame, text="None Available")
            label.grid(row=count + 6, column=0, sticky=tk.W)

        self.redraw()

    def redraw(self, event=None):
        basis = self.basisBox.current() + 1
        axial_level = self.axialBox.current() + 1
        is_mean = self.meanBox.current()

        # Get selected tally
        tally_id = self.meshTallies[self.tallyBox.current()]
        selectedTally = self.datafile.tallies[tally_id]

        # Create spec_list
        spec_list = []
        for f in selectedTally.filters.values():
            if f.type == 'mesh':
                continue
            index = self.filterBoxes[f.type].current()
            spec_list.append((f.type, index))

        # Take is_mean and convert it to an index of the score
        score_loc = is_mean
        if score_loc > 1:
            score_loc = 1

        text = self.basisBox['values'][self.basisBox.current()]
        if text == 'xy':
            matrix = np.zeros((self.nx, self.ny))
            for i in range(self.nx):
                for j in range(self.ny):
                    matrix[i, j] = self.datafile.get_value(
                        tally_id,
                        spec_list + [('mesh', (i + 1, j + 1, axial_level))],
                        self.scoreBox.current())[score_loc]
                    # Calculate relative uncertainty from absolute, if requested
                    if is_mean == 2:
                        # Take care to handle zero means when normalizing
                        mean_val = self.datafile.get_value(
                            tally_id,
                            spec_list + [('mesh',
                                          (i + 1, j + 1, axial_level))],
                            self.scoreBox.current())[0]
                        if mean_val > 0.0:
                            matrix[i, j] = matrix[i, j] / mean_val
                        else:
                            matrix[i, j] = 0.0

        elif text == 'yz':
            matrix = np.zeros((self.ny, self.nz))
            for i in range(self.ny):
                for j in range(self.nz):
                    matrix[i, j] = self.datafile.get_value(
                        tally_id,
                        spec_list + [('mesh', (axial_level, i + 1, j + 1))],
                        self.scoreBox.current())[score_loc]
                    # Calculate relative uncertainty from absolute, if requested
                    if is_mean == 2:
                        # Take care to handle zero means when normalizing
                        mean_val = self.datafile.get_value(
                            tally_id,
                            spec_list + [('mesh',
                                          (axial_level, i + 1, j + 1))],
                            self.scoreBox.current())[0]
                        if mean_val > 0.0:
                            matrix[i, j] = matrix[i, j] / mean_val
                        else:
                            matrix[i, j] = 0.0

        else:
            matrix = np.zeros((self.nx, self.nz))
            for i in range(self.nx):
                for j in range(self.nz):
                    matrix[i, j] = self.datafile.get_value(
                        tally_id,
                        spec_list + [('mesh', (i + 1, axial_level, j + 1))],
                        self.scoreBox.current())[score_loc]
                    # Calculate relative uncertainty from absolute, if requested
                    if is_mean == 2:
                        # Take care to handle zero means when normalizing
                        mean_val = self.datafile.get_value(
                            tally_id,
                            spec_list + [('mesh',
                                          (i + 1, axial_level, j + 1))],
                            self.scoreBox.current())[0]
                        if mean_val > 0.0:
                            matrix[i, j] = matrix[i, j] / mean_val
                        else:
                            matrix[i, j] = 0.0

        # Clear the figure
        self.fig.clear()

        # Make figure, set up color bar
        self.axes = self.fig.add_subplot(111)
        cax = self.axes.imshow(matrix.transpose(),
                               vmin=0.0,
                               vmax=matrix.max(),
                               interpolation='none',
                               origin='lower')
        self.fig.colorbar(cax)

        self.axes.set_xticks([])
        self.axes.set_yticks([])
        self.axes.set_aspect('equal')

        # Draw canvas
        self.canvas.draw()

    def get_file_data(self, filename):
        # Create StatePoint object and read in data
        self.datafile = StatePoint(filename)
        self.datafile.read_results()
        self.datafile.generate_stdev()

        # Find which tallies are mesh tallies
        self.meshTallies = []
        for itally, tally in enumerate(self.datafile.tallies):
            if 'mesh' in tally.filters:
                self.meshTallies.append(itally)

        if not self.meshTallies:
            messagebox.showerror("Invalid StatePoint File",
                                 "File does not contain mesh tallies!")
            sys.exit(1)
Ejemplo n.º 36
0
    def create_widgets(self):
        figureFrame = tk.Frame(self)
        figureFrame.grid(row=0, column=0)

        # Create the Figure and Canvas
        self.dpi = 100
        self.fig = Figure((5.0, 5.0), dpi=self.dpi)
        self.canvas = FigureCanvasTkAgg(self.fig, master=figureFrame)
        self.canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=1)

        # Create the navigation toolbar, tied to the canvas
        self.mpl_toolbar = NavigationToolbar2TkAgg(self.canvas, figureFrame)
        self.mpl_toolbar.update()
        self.canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=1)

        # Create frame for comboboxes
        self.selectFrame = tk.Frame(self)
        self.selectFrame.grid(row=1, column=0, sticky=tk.W + tk.E)

        # Tally selection
        labelTally = tk.Label(self.selectFrame, text='Tally:')
        labelTally.grid(row=0, column=0, sticky=tk.W)
        self.tallyBox = ttk.Combobox(self.selectFrame, state='readonly')
        self.tallyBox['values'] = [
            self.datafile.tallies[i].id for i in self.meshTallies
        ]
        self.tallyBox.current(0)
        self.tallyBox.grid(row=0, column=1, sticky=tk.W + tk.E)
        self.tallyBox.bind('<<ComboboxSelected>>', self.update)

        # Planar basis selection
        labelBasis = tk.Label(self.selectFrame, text='Basis:')
        labelBasis.grid(row=1, column=0, sticky=tk.W)
        self.basisBox = ttk.Combobox(self.selectFrame, state='readonly')
        self.basisBox['values'] = ('xy', 'yz', 'xz')
        self.basisBox.current(0)
        self.basisBox.grid(row=1, column=1, sticky=tk.W + tk.E)
        self.basisBox.bind('<<ComboboxSelected>>', self.update)

        # Axial level
        labelAxial = tk.Label(self.selectFrame, text='Axial level:')
        labelAxial.grid(row=2, column=0, sticky=tk.W)
        self.axialBox = ttk.Combobox(self.selectFrame, state='readonly')
        self.axialBox.grid(row=2, column=1, sticky=tk.W + tk.E)
        self.axialBox.bind('<<ComboboxSelected>>', self.redraw)

        # Option for mean/uncertainty
        labelMean = tk.Label(self.selectFrame, text='Mean/Uncertainty:')
        labelMean.grid(row=3, column=0, sticky=tk.W)
        self.meanBox = ttk.Combobox(self.selectFrame, state='readonly')
        self.meanBox['values'] = ('Mean', 'Absolute uncertainty',
                                  'Relative uncertainty')
        self.meanBox.current(0)
        self.meanBox.grid(row=3, column=1, sticky=tk.W + tk.E)
        self.meanBox.bind('<<ComboboxSelected>>', self.update)

        # Scores
        labelScore = tk.Label(self.selectFrame, text='Score:')
        labelScore.grid(row=4, column=0, sticky=tk.W)
        self.scoreBox = ttk.Combobox(self.selectFrame, state='readonly')
        self.scoreBox.grid(row=4, column=1, sticky=tk.W + tk.E)
        self.scoreBox.bind('<<ComboboxSelected>>', self.redraw)

        # Filter label
        boldfont = font.Font(weight='bold')
        labelFilters = tk.Label(self.selectFrame,
                                text='Filters:',
                                font=boldfont)
        labelFilters.grid(row=5, column=0, sticky=tk.W)
Ejemplo n.º 37
0
f = []
z=x1
for i in range(200):
       z=x1+(i*float(y-x1)/200)
       f.append(z)

root = Tk.Tk()
root.wm_title("Hamara bajaj")
fls = Figure(figsize=(5, 4), dpi=100)
a = fls.add_subplot(111)
a.plot(f, g)
a.set_title(Title)
a.set_xlabel(xlabel)
a.set_ylabel(ylabel)


# a tk.DrawingArea
canvas = FigureCanvasTkAgg(fls, master=root)
canvas.show()
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 _quit():
    root.quit()     # stops mainloop
    root.destroy()

Tk.mainloop()
Ejemplo n.º 38
0
def createWidgit():

    global ax, canvas, listbox_l, result, func, frame, sense

    fig = pylab.figure(1)

    ax = fig.add_subplot(111)
    ax.grid(True)
    ax.set_title("Realtime Resistance vs I Plot")
    ax.set_xlabel("Applied Current (mA)")
    ax.set_ylabel("Hall Resistance (Ohm)")
    ax.axis([-1, 1, -1, 1])

    content = ttk.Frame(root, padding=(3, 3, 12, 12))

    #plotting area
    frame = ttk.Frame(content,
                      borderwidth=0,
                      relief="sunken",
                      padding=(3, 3, 12, 12))
    frame_setting = ttk.Frame(content)
    frame_information = ttk.Frame(content, padding=(3, 3, 12, 12))
    frame_buttomArea = ttk.Frame(content)

    #Save Variables
    entry_sample = ttk.Entry(frame_information)
    entry_sample.insert(0, "sample name")

    #Function Variables
    entry_interval = ttk.Entry(frame_setting)
    entry_interval.insert(0, "1022")
    entry_output = ttk.Entry(frame_setting)
    entry_output.insert(0, "200")
    entry_sense = ttk.Entry(frame_setting)
    entry_sense.insert(0, "1")  #K2400 sensing current
    entry_current = ttk.Entry(frame_setting)
    entry_current.insert(0, "0")
    entry_step = ttk.Entry(frame_setting)
    entry_step.insert(0, "0.5")
    entry_Hx = ttk.Entry(frame_setting)
    entry_Hx.insert(0, "0")
    entry_dHx = ttk.Entry(frame_setting)
    entry_dHx.insert(0, "100")
    entry_intervalx = ttk.Entry(frame_setting)
    entry_intervalx.insert(0, "396.59")
    entry_switch_width = ttk.Entry(frame_setting)
    entry_switch_width.insert(0, "0.05")
    entry_sense_width = ttk.Entry(frame_setting)
    entry_sense_width.insert(0, "0.05")
    entry_switch_sense = ttk.Entry(frame_setting)
    entry_switch_sense.insert(0, "0.05")
    entry_period = ttk.Entry(frame_setting)
    entry_period.insert(0, "0.05")

    value3 = tkinter.IntVar()  #dac
    value4 = tkinter.IntVar()  #dacx

    dac = [2, 1, 2, 3, 4]
    dacx = [3, 1, 2, 3, 4]

    option_dac = ttk.OptionMenu(frame_setting, value3, *dac, command=dacMethod)
    option_dacx = ttk.OptionMenu(frame_setting,
                                 value4,
                                 *dacx,
                                 command=dacxMethod)

    listbox_l = Listbox(frame_information, height=5)
    scrollbar_s = ttk.Scrollbar(frame_information,
                                orient=VERTICAL,
                                command=listbox_l.yview)

    label_interval = ttk.Label(frame_setting,
                               text="Hz(Oe)/DAC(V):")  #calibration factor
    label_output = ttk.Label(frame_setting, text="Hz field (Oe):")
    label_sense = ttk.Label(frame_setting, text="Sense current (mA):")
    label_dac = ttk.Label(frame_setting, text="Hz DAC Channel:")
    label_dacx = ttk.Label(frame_setting, text="Hx DAC Channel:")
    label_current = ttk.Label(frame_setting, text="Write current (mA):")
    label_step = ttk.Label(frame_setting, text="Current step (mA):")
    label_Hx = ttk.Label(frame_setting, text="Hx field (Oe):")
    label_dHx = ttk.Label(frame_setting, text="Hx step (Oe):")
    label_intervalx = ttk.Label(frame_setting, text="Hx(Oe)/DAC(V):")
    label_switch_width = ttk.Label(frame_setting,
                                   text="Write pulse width (s):")
    label_sense_width = ttk.Label(frame_setting, text="Sense pulse width (s):")
    label_switch_sense = ttk.Label(frame_setting,
                                   text="Write-sense pause (s):")
    label_period = ttk.Label(frame_setting, text="Period (s):")
    label_empty = ttk.Label(frame_setting, text="")

    button_measure = ttk.Button(frame_buttomArea, text ="Measure",\
     command = lambda : measureMethod(entry_current.get(),entry_step.get(),entry_Hx.get(),\
        entry_dHx.get(),entry_intervalx.get(),entry_sense.get(),entry_switch_width.get(),\
        entry_sense_width.get(),entry_switch_sense.get(),entry_period.get(),entry_sample.get()))

    button_dir = ttk.Button(frame_buttomArea,
                            text="Change directory",
                            command=dirMethod)
    button_quit = ttk.Button(frame_buttomArea, text="Quit", command=quitMethod)
    button_output = ttk.Button(
        frame_buttomArea,
        text="Output",
        command=lambda: outputMethod(entry_interval.get(), entry_output.get()))
    button_clear = ttk.Button(frame_buttomArea,
                              text="Clear",
                              command=clearMethod)

    #Attatch Plot
    canvas = FigureCanvasTkAgg(fig, frame)
    canvas.get_tk_widget().grid(row=0, column=0, pady=0, padx=0, sticky='nsew')
    content.grid(column=0, row=0, sticky=(N, S, E, W))
    frame.grid(column=0, row=0, columnspan=3, rowspan=30, sticky=(N, S, E, W))

    frame_setting.grid(column=3,
                       row=0,
                       columnspan=2,
                       rowspan=30,
                       sticky=(N, S, E, W))

    #Frame setting grid

    #Save setings
    label_sample = ttk.Label(frame_information, text="Sample Name")

    #Hz settings
    label_dac.grid(column=0, row=1, columnspan=2, sticky=(N, W), padx=5)
    option_dac.grid(column=0, row=2, columnspan=2, sticky=(N, W), padx=5)
    label_interval.grid(column=0, row=3, columnspan=2, sticky=(N, W), padx=5)
    entry_interval.grid(column=0, row=4, columnspan=2, sticky=(N, W), padx=5)
    label_output.grid(column=0, row=5, columnspan=2, sticky=(N, W), padx=5)
    entry_output.grid(column=0, row=6, columnspan=2, sticky=(N, W), padx=5)

    #Hx settings
    label_dacx.grid(column=0, row=7, columnspan=2, sticky=(N, W), padx=5)
    option_dacx.grid(column=0, row=8, columnspan=2, sticky=(N, W), padx=5)
    label_intervalx.grid(column=0, row=9, columnspan=2, sticky=(N, W), padx=5)
    entry_intervalx.grid(column=0, row=10, columnspan=2, sticky=(N, W), padx=5)
    label_Hx.grid(column=0, row=11, columnspan=2, sticky=(N, W), padx=5)
    entry_Hx.grid(column=0, row=12, columnspan=2, sticky=(N, W), padx=5)
    label_dHx.grid(column=0, row=13, columnspan=2, sticky=(N, W), padx=5)
    entry_dHx.grid(column=0, row=14, columnspan=2, sticky=(N, W), padx=5)

    #Current settings
    label_sense.grid(column=0, row=15, columnspan=2, sticky=(N, W), padx=5)
    entry_sense.grid(column=0, row=16, columnspan=2, sticky=(N, W), padx=5)
    label_current.grid(column=0, row=17, columnspan=2, sticky=(N, W), padx=5)
    entry_current.grid(column=0, row=18, columnspan=2, sticky=(N, W), padx=5)
    label_step.grid(column=0, row=19, columnspan=2, sticky=(N, W), padx=5)
    entry_step.grid(column=0, row=20, columnspan=2, sticky=(N, W), padx=5)

    label_switch_width.grid(column=0,
                            row=21,
                            columnspan=2,
                            sticky=(N, W),
                            padx=5)
    entry_switch_width.grid(column=0,
                            row=22,
                            columnspan=2,
                            sticky=(N, W),
                            padx=5)
    label_sense_width.grid(column=0,
                           row=23,
                           columnspan=2,
                           sticky=(N, W),
                           padx=5)
    entry_sense_width.grid(column=0,
                           row=24,
                           columnspan=2,
                           sticky=(N, W),
                           padx=5)
    label_switch_sense.grid(column=0,
                            row=25,
                            columnspan=2,
                            sticky=(N, W),
                            padx=5)
    entry_switch_sense.grid(column=0,
                            row=26,
                            columnspan=2,
                            sticky=(N, W),
                            padx=5)
    label_period.grid(column=0, row=27, columnspan=2, sticky=(N, W), padx=5)
    entry_period.grid(column=0, row=28, columnspan=2, sticky=(N, W), padx=5)

    label_empty.grid(column=0, row=31, columnspan=2, sticky=(N, W), padx=5)

    frame_information.grid(column=0, row=31, columnspan=3, sticky=(N, W, E, S))

    listbox_l.grid(column=0, row=0, columnspan=3, sticky=(N, W, E, S))
    scrollbar_s.grid(column=1, row=0, sticky=(N, S))

    listbox_l['yscrollcommand'] = scrollbar_s.set

    label_sample.grid(column=0,
                      row=2,
                      columnspan=1,
                      sticky=(N, W, E, S),
                      padx=5)
    entry_sample.grid(column=0,
                      row=3,
                      columnspan=1,
                      sticky=(N, W, E, S),
                      padx=5)

    frame_information.grid_columnconfigure(0, weight=1)
    frame_information.grid_rowconfigure(0, weight=1)

    frame_buttomArea.grid(column=3, row=31, columnspan=2, sticky=(N, S, E, W))

    button_output.grid(column=0, row=0, columnspan=2, sticky=(N, S, E, W))
    button_measure.grid(column=0, row=1, columnspan=2, sticky=(N, S, E, W))
    button_clear.grid(column=0, row=3, columnspan=1, sticky=(N, S, E, W))
    button_dir.grid(column=0, row=2, columnspan=2, sticky=(N, S, E, W))
    button_quit.grid(column=1, row=3, columnspan=1, sticky=(N, S, E, W))

    root.columnconfigure(0, weight=1)
    root.rowconfigure(0, weight=1)

    content.columnconfigure(0, weight=3)
    content.columnconfigure(1, weight=3)
    content.columnconfigure(2, weight=3)
    content.columnconfigure(3, weight=1)
    content.columnconfigure(4, weight=1)
    content.rowconfigure(1, weight=1)