def setUpWidgets(self): self.formantPlotFrame = Frame(self.parent, width=FORMANTPLOTFRAMEWIDTH, height=FORMANTPLOTFRAMEHEIGHT) self.formantPlotFrame.grid() self.formantPlotCanvas = SnackCanvas(self.formantPlotFrame, height=FORMANTPLOTHEIGHT, width=FORMANTPLOTWIDTH, bg='white') self.formantPlotCanvas.grid(row=0, column=0) self.loudnessMeterCanvas = SnackCanvas(self.formantPlotFrame, height=FORMANTPLOTHEIGHT, width=10) self.loudnessMeterCanvas.grid(row=0, column=1) self.formantPlotControlFrame = Frame(self.formantPlotFrame) self.formantPlotControlFrame.grid(row=1, column=0, sticky='w' + 'e', columnspan=2) self.formantPlotControlFrame.columnconfigure(0, minsize=FORMANTPLOTWIDTH / 3) self.formantPlotControlFrame.columnconfigure(1, minsize=FORMANTPLOTWIDTH / 3) self.formantPlotControlFrame.columnconfigure(2, minsize=FORMANTPLOTWIDTH / 3) self.recButton = ttk.Button(self.formantPlotControlFrame, text='Record', command=self.record, style='Fun.TButton') self.recButton.grid(row=1, column=0, sticky='w' + 'e', padx=10) self.stopButton = ttk.Button(self.formantPlotControlFrame, text='Stop', command=self.stop, state='disabled', style='Fun.TButton') self.stopButton.grid(row=1, column=1, sticky='w' + 'e', padx=10) self.clearScreenButton = ttk.Button(self.formantPlotControlFrame, text='Clear Plot', command=self.clearUserFormants, state='normal', style='Fun.TButton') self.clearScreenButton.grid(row=1, column=2, sticky='w' + 'e' + 'n' + 's') self.loudnessMeter = LoudnessMeter(self.loudnessMeterCanvas)
def setupPlot(self): #Plot self.vowelPlotFrame = self.parent self.vowelPlotCanvas = Canvas(self.vowelPlotFrame, height=self.width, width=self.height, bg='white') self.vowelPlotCanvas.delete('Loudness') self.vowelPlotCanvas.delete('toLoud') self.vowelPlotCanvas.delete('toQuiet') self.vowelPlotCanvas.pack(fill='both', expand=1) #Creates the loudnessMeter on the formant plot canvas. self.loudnessMeter = LoudnessMeter(self.vowelPlotCanvas, YSHIFT) font = ('Arial', '14') boxWidth = 150 self.font = font x1 = (self.height / 2) - (boxWidth) y1 = 2 x2 = (self.height / 2) y2 = 32 self.recordingBox = self.vowelPlotCanvas.create_rectangle( x1, y1, x2, y2, tag='recording', fill='red', outline='white') self.recordingBoxText = self.vowelPlotCanvas.create_text( (x1 + x2) / 2, (y1 + y2) / 2, tag='recordingText', text='Recording.', font=font, fill='black') self.vowelPlotCanvas.itemconfig('recording', state='hidden') self.vowelPlotCanvas.itemconfig('recordingText', state='hidden') x1 = (self.height / 2) y1 = 2 x2 = (self.height / 2) + boxWidth y2 = 32 self.recordingBox = self.vowelPlotCanvas.create_rectangle( x1, y1, x2, y2, tag='Loudness', outline='black') self.recordingBoxText = self.vowelPlotCanvas.create_text( (x1 + x2) / 2, (y1 + y2) / 2, tag='toLoud', text='Too Loud.', font=font, fill='black') self.recordingBoxText = self.vowelPlotCanvas.create_text( (x1 + x2) / 2, (y1 + y2) / 2, tag='toQuiet', text='Too Quiet.', font=font, fill='black') self.vowelPlotCanvas.itemconfig('Loudness', state='hidden') self.vowelPlotCanvas.itemconfig('toLoud', state='hidden') self.vowelPlotCanvas.itemconfig('toQuiet', state='hidden')
def setupPlot(self): #Plot self.formantPlotFrame = self.parent # self.formantPlotCanvas = Canvas(self.formantPlotFrame, height=PLOTHEIGHT-60, width=PLOTWIDTH, bg='white') self.formantPlotCanvas = Canvas(self.formantPlotFrame, height=PLOTHEIGHT, width=PLOTWIDTH, bg='white') #self.formantPlotCanvas.grid(row=0 ,column=0, sticky=N+S+E+W) self.formantPlotCanvas.pack(fill=BOTH, expand=YES) self.formantPlotCanvas.bind("<Button-1>", self.requestRecord) #Creates the loudnessMeter on the formant plot canvas. self.loudnessMeter = LoudnessMeter(self.formantPlotCanvas, YSHIFT) self.createBoxs()