def setup_widgets(self): """Five control widgets created along bottom""" # clear button clear_button = Button(self, text="Clear") clear_button.grid(row=3, column=1, padx=5, pady=5, sticky=W) clear_button.bind("<ButtonRelease-1>", self.clear_text) # Silent/Verbose select verbose_check = Checkbutton(self, text="Silent", \ variable=self.verbose_flag, onvalue="-s", offvalue="") verbose_check.grid(row=3, column=2, padx=5, pady=5) # Analysis model menu choices2 = ['Select Model', 'model1', 'model2'] om2 = OptionMenu(self, self.model, *choices2) # pylint: disable=W0142 om2.grid(row=3, column=3, padx=10, pady=20) # EMR Server Region menu choices = ['Select Region', 'Oregon', 'California', 'Virginia'] om1 = OptionMenu(self, self.region, *choices) # pylint: disable=W0142 om1.grid(row=3, column=4, padx=10, pady=20) # Run EMR button emrbutton = Button(self, text="Run EMR") emrbutton.grid(row=3, column=5, padx=5, pady=5) emrbutton.bind("<ButtonRelease-1>", self.run_emr)
def excel_popup(field): sub_window = Toplevel(background="#333", padx=15, pady=15) sub_window.title("Aya's Finder: Import data from Excel file") sub_window.wm_iconbitmap(r"images\Dna-Helix.ico") row_col = StringVar() row_col.set("row") Radiobutton(sub_window, variable=row_col, value="row", text="Row").grid(row=0, column=0) Radiobutton(sub_window, variable=row_col, value="col", text="Column").grid(row=0, column=1) file_name_var = StringVar() sheet_name_var = StringVar() num_var = IntVar() Label(sub_window, justify="left", width="17", text="File name").grid(row=1, column=0) Label(sub_window, justify="left", width="17", text="Sheet name").grid(row=2, column=0) Label(sub_window, justify="left", width="17", text="Row/Column number").grid(row=3, column=0) Entry(sub_window, width="32", textvariable=file_name_var).grid(row=1, column=1) Entry(sub_window, width="7", textvariable=num_var).grid(row=3, column=1) sheets = OptionMenu(sub_window, sheet_name_var, '') sheets.config(width=32) sheets.grid(row=2, column=1) def get(): file_name = file_name_var.get() sheet_name = sheet_name_var.get() num = num_var.get() try: if row_col.get() == "row": field.delete(1.0, END) field.insert(INSERT, get_from_excel(file_name, sheet_name, row_num=num)) else: field.delete(1.0, END) field.insert(INSERT, get_from_excel(file_name, sheet_name, col_num=num)) sub_window.destroy() except Exception: pass def browser(): try: name = askopenfilename(parent=sub_window) file_name_var.set(name) sheets.set_menu('---', *get_excel_sheets(file_name_var.get())) sub_window.focus() except IOError: pass Button(sub_window, text="OK", command=get).grid(row=5, column=0) Button(sub_window, text="Cancel", command=lambda: sub_window.destroy()).grid(row=5, column=1) Button(sub_window, text="browse", command=browser).grid(row=1, column=3)
def initUI(self): self.parent.title("Finger Putty") self.style = Style() self.style.theme_use("default") self.pack(fill=BOTH, expand=1) # Logo text # logoText = Text(self) # OS drop-down button variable = StringVar(self) variable.set("Linux") osDropdownButton = OptionMenu(self, variable, "Choose your OS", "Linux", "Windows", "Playstation", "Revert Defaults") osDropdownButton.pack() osDropdownButton.place(x=50, y=50) # Set (OS) fingerprint button def fcallback(): if variable.get() == "Revert Defaults": setctl.defaults() elif variable.get() != "Choose your OS": setctl.control(variable.get()) changePrintButton = Button(self, text="Set fingerprint", command=fcallback) changePrintButton.place(x=50, y=80) # Launch browser button def bcallback(): useragent.getVersion() useragent.launchBrowser() launchButton = Button(self, text="Launch browser (new user-agent)", command=bcallback) launchButton.place(x=50, y=110)
def __init__(self, master, instrument): InstrumentFrame.__init__(self, master, instrument) scale_name = [s.__name__ for s in scales.SCALES] scale_name = [type(instrument.scale).__name__] + scale_name variable = StringVar(self) w = OptionMenu(self, variable, *scale_name, command=self.set_scale) w.grid(row=1, sticky="W", padx=3) freq_frame = Frame(self) freq_frame.grid(row=2, sticky="W", padx=3) Label(freq_frame, text="Base Frequency (Hz): ").pack(side="left") self.freq_var = StringVar(self) self.freq_var.set(str(instrument.scale.base_frequency)) freq_entry = Entry(freq_frame, textvariable=self.freq_var, width=5) freq_entry.pack(side="left") freq_update = Button(freq_frame, text="Update", command=self.set_frequncy) freq_update.pack(side="left")
def initUI(self): self.parent.title("Simple") self.pack(fill=BOTH, expand=True) self.centerWindow() sw = self.parent.winfo_screenwidth() sh = self.parent.winfo_screenheight() frame1 = Frame(self, relief=RAISED, borderwidth=1) frame1.pack(fill=X) button1 = Button(frame1, text=u"<", command=self.prevDocument) button1.pack(side=LEFT, padx=5, pady=5) button2 = Button(frame1, text=u">", command=self.nextDocument) button2.pack(side=LEFT, padx=5, pady=5) self.selCategory = StringVar(self) self.categoryOption = OptionMenu(frame1, self.selCategory, *["Categories"], command=self.changeCategory) self.categoryOption.pack(side=LEFT, padx=5, pady=5) self.entry1 = Entry(frame1) self.entry1.pack(side=LEFT, padx=5, pady=5) self.ignoreActualDocVar = IntVar(self) checkButton1 = Checkbutton(frame1, text="Ignored", variable=self.ignoreActualDocVar) checkButton1.pack(side=LEFT, padx=5, pady=5) button3 = Button(frame1, text=u"Save document", command=self.prevDocument) button3.pack(side=LEFT, padx=5, pady=5) #entry1 = Entry(frame1) #entry1.pack(fill=X, padx=5, expand=True) frame2 = PanedWindow(self, orient=HORIZONTAL) frame2.pack(fill=BOTH, expand=1) self.txt1 = Text(frame2, width=sw/22) frame2.add(self.txt1) self.txt2 = Text(frame2) self.txt2.bind("<Button-3>", self.popup) frame2.add(self.txt2) frame3 = Frame(self, relief=RAISED, borderwidth=1) frame3.pack(fill=X) #lbl3 = Label(frame3, text="Author", width=6) #lbl3.pack(side=LEFT, padx=5, pady=5) #entry3 = Entry(frame3) #entry3.pack(fill=X, padx=5, expand=True) self.swVar = IntVar(self) checkButton1 = Checkbutton(frame3, text="Remove stop words", variable=self.swVar) checkButton1.pack(side=LEFT, padx=5, pady=5) self.lowerVar = IntVar(self) checkButton1 = Checkbutton(frame3, text="Convert to lower case", variable=self.lowerVar) checkButton1.pack(side=LEFT, padx=5, pady=5) button3 = Button(frame3, text=u"Apply", command=self.applyProcessing) button3.pack(side=LEFT, padx=5, pady=5) #self.readCorpus() # create a toplevel menu menubar = Menu(self) filemenu = Menu(menubar, tearoff=0) filemenu.add_command(label="Quit", command=self.parent.quit) filemenu.add_command(label="Open corpus", command=self.loadCorpus) menubar.add_cascade(label="Project", menu=filemenu) #menubar.add_command(label="Quit!") # , command=root.quit # display the menu self.parent.config(menu=menubar) self.popupmenu = Menu(self.parent, tearoff=0) self.popupmenu.add_command(label="Undo", command=self.hello) self.popupmenu.add_command(label="Redo", command=self.hello)
class Example(Frame): def __init__(self, parent): Frame.__init__(self) self.parent = parent self.processor = TextProcessor() self.initUI() def readCorpus(self, path): self.data = Corpus(path) self.processor.calculateConditionalFrequency(self.data, self.selCategory.get()) #self.processor.calculateTotalTermFrequency(self.data) self.categoryOption['menu'].delete(0, 'end') for attr in self.data.attributes: self.categoryOption['menu'].add_command(label=attr, command=lambda v=attr: self.changeCategory(v) ) self.curdoc=0 self.txt1.delete('1.0', END) self.txt1.insert('1.0', self.data.docs[self.curdoc].text) def refreshTextInfo(self): if self.selCategory.get() != 'Categories': idcat = self.data.attributes.index(self.selCategory.get()) self.entry1.delete(0, END) self.entry1.insert(0, self.data.getAttributeVal(self.curdoc, self.selCategory.get() )) self.txt1.delete('1.0', END) self.txt1.insert('1.0', self.data.docs[self.curdoc].text) self.applyProcessing() def changeCategory(self, value): self.selCategory.set(value) self.entry1.delete(0, END) self.entry1.insert(0, self.data.getAttributeVal(self.curdoc, self.selCategory.get())) self.processor.calculateConditionalFrequency(self.data, self.selCategory.get()) def prevDocument(self): if self.curdoc>0: self.curdoc-=1 self.refreshTextInfo() def nextDocument(self): if self.curdoc<self.data.ndocs-1: self.curdoc+=1 self.refreshTextInfo() def popup(self, event): print "hello "+str(event.widget) self.popupmenu.tk_popup(event.x_root, event.y_root, 0) print event.widget.index("@%s,%s" % (event.x, event.y)) def applyProcessing(self): if self.selCategory.get() != 'Categories': indxCat = self.data.attributes.index( self.selCategory.get() ) textResult = self.processor.process(self.data.docs[self.curdoc], indxCat) else: textResult = "" self.txt2.delete('1.0', END) self.txt2.insert('1.0', textResult) def loadCorpus(self): path = tkFileDialog.askdirectory() self.readCorpus(path) self.refreshTextInfo() def hello(self): print "Hello" def initUI(self): self.parent.title("Simple") self.pack(fill=BOTH, expand=True) self.centerWindow() sw = self.parent.winfo_screenwidth() sh = self.parent.winfo_screenheight() frame1 = Frame(self, relief=RAISED, borderwidth=1) frame1.pack(fill=X) button1 = Button(frame1, text=u"<", command=self.prevDocument) button1.pack(side=LEFT, padx=5, pady=5) button2 = Button(frame1, text=u">", command=self.nextDocument) button2.pack(side=LEFT, padx=5, pady=5) self.selCategory = StringVar(self) self.categoryOption = OptionMenu(frame1, self.selCategory, *["Categories"], command=self.changeCategory) self.categoryOption.pack(side=LEFT, padx=5, pady=5) self.entry1 = Entry(frame1) self.entry1.pack(side=LEFT, padx=5, pady=5) self.ignoreActualDocVar = IntVar(self) checkButton1 = Checkbutton(frame1, text="Ignored", variable=self.ignoreActualDocVar) checkButton1.pack(side=LEFT, padx=5, pady=5) button3 = Button(frame1, text=u"Save document", command=self.prevDocument) button3.pack(side=LEFT, padx=5, pady=5) #entry1 = Entry(frame1) #entry1.pack(fill=X, padx=5, expand=True) frame2 = PanedWindow(self, orient=HORIZONTAL) frame2.pack(fill=BOTH, expand=1) self.txt1 = Text(frame2, width=sw/22) frame2.add(self.txt1) self.txt2 = Text(frame2) self.txt2.bind("<Button-3>", self.popup) frame2.add(self.txt2) frame3 = Frame(self, relief=RAISED, borderwidth=1) frame3.pack(fill=X) #lbl3 = Label(frame3, text="Author", width=6) #lbl3.pack(side=LEFT, padx=5, pady=5) #entry3 = Entry(frame3) #entry3.pack(fill=X, padx=5, expand=True) self.swVar = IntVar(self) checkButton1 = Checkbutton(frame3, text="Remove stop words", variable=self.swVar) checkButton1.pack(side=LEFT, padx=5, pady=5) self.lowerVar = IntVar(self) checkButton1 = Checkbutton(frame3, text="Convert to lower case", variable=self.lowerVar) checkButton1.pack(side=LEFT, padx=5, pady=5) button3 = Button(frame3, text=u"Apply", command=self.applyProcessing) button3.pack(side=LEFT, padx=5, pady=5) #self.readCorpus() # create a toplevel menu menubar = Menu(self) filemenu = Menu(menubar, tearoff=0) filemenu.add_command(label="Quit", command=self.parent.quit) filemenu.add_command(label="Open corpus", command=self.loadCorpus) menubar.add_cascade(label="Project", menu=filemenu) #menubar.add_command(label="Quit!") # , command=root.quit # display the menu self.parent.config(menu=menubar) self.popupmenu = Menu(self.parent, tearoff=0) self.popupmenu.add_command(label="Undo", command=self.hello) self.popupmenu.add_command(label="Redo", command=self.hello) def centerWindow(self): sw = self.parent.winfo_screenwidth() sh = self.parent.winfo_screenheight() w = sw/1.5 h = sh/1.5 x = (sw - w) / 2 y = (sh - h) / 2 self.parent.geometry('%dx%d+%d+%d' % (w, h, x, y))
def StartGui(self): self.tkRoot = Tk(baseName="") self.tkRoot.geometry("350x300+0+0") self.tkRoot.title("Engine SAPI GUI") self.GUIVisible = True frame = Frame(self.tkRoot) frame.style = Style() frame.style.theme_use("alt") frame.pack(fill=BOTH, expand=1) frame.columnconfigure(1, weight=1) frame.columnconfigure(7, pad=7) frame.rowconfigure(13, weight=1) frame.rowconfigure(13, pad=7) Label(frame, text="Start:").grid(row = 0, column=0) self.labelStart = Label(frame, text="0") self.labelStart.grid(row = 1, column=0) Label(frame, text="Length:").grid(row = 0, column=1) self.labelLength = Label(frame, text="0") self.labelLength.grid(row = 1, column=1) Label(frame, text="Total:").grid(row = 0, column=2) self.labelTotal = Label(frame, text="0") self.labelTotal.grid(row = 1, column=2) self.labelSentenceLeft = Label(frame, text="...") self.labelSentenceLeft.grid(row = 2, column=0, sticky=E) self.labelSentenceSpoken = Label(frame, text="...", foreground="red") self.labelSentenceSpoken.grid(row = 2, column=1) self.labelSentenceRight = Label(frame, text="...") self.labelSentenceRight.grid(row = 2, column=2, sticky=W, columnspan=2) scrollbar = Scrollbar(frame, orient=VERTICAL) self.labelQueueToSpeak = Label(frame, text="Queue to speak:").grid(row = 3, column=0, pady=4, padx=5, sticky=W) self.listboxQueueToSpeak = Listbox(frame, width=50, height=3, yscrollcommand=scrollbar.set) scrollbar.config(command=self.listboxQueueToSpeak.yview) self.listboxQueueToSpeak.grid( sticky=N+S+E+W, row = 4, column = 0, columnspan = 2 ,rowspan = 3, padx=3) scrollbar.grid(sticky=N+S+W, row = 4, column = 2, rowspan = 3) self.buttonPauze = Button(frame, text="Pauze", command=self.communicationProtocal.handlePauze) self.buttonPauze.grid(row = 4, column=3) self.buttonStop = Button(frame, text="Stop", command=self.communicationProtocal.restartProcess) self.buttonStop.grid(row = 5, column=3) self.buttonResume = Button(frame, text="Resume", command=self.communicationProtocal.handleResume) self.buttonResume.grid(row = 6, column=3) Label(frame, text="Text to say:").grid(row = 7, column=0, padx=3, sticky=W) self.stringVarTextToSay = StringVar() self.entryTextToSay = Entry(frame, textvariable=self.stringVarTextToSay, width=500) self.entryTextToSay.grid(row=8, column=0, columnspan=3, padx=3, sticky=W) self.stringVarTextToSay.set("Hello SAPI Speak Engine") self.entryTextToSay.bind('<Return>', self.CallBackReturnSay) self.buttonSay = Button(frame, text="Say", command=self.CallBackButtonSay) self.buttonSay.grid(row = 8, column=3) Label(frame, text="Recover action:").grid(row = 9, column=0, padx=3, sticky=W) self.recoverActionLabelText = "None" self.labelRecoverAction = Label(frame, text=self.recoverActionLabelText, foreground="blue") self.labelRecoverAction.grid(row = 10, column=0) Label(frame, text="Voice speed:").grid(row = 9, column=1, sticky=W) self.buttonSpeedDown = Button(frame, text="Speed down", command=self.communicationProtocal.handleSpeedDown) self.buttonSpeedDown.grid(row = 10, column=1, padx=3, sticky=E) self.speedValue = 0 self.intVarSpeed = IntVar() vcmd = (self.tkRoot.register(self.OnValidateEntrySpeakSpeed), '%d', '%i', '%P', '%s', '%S', '%v', '%V', '%W') self.entrySpeakSpeed = Entry(frame, textvariable=self.intVarSpeed, validate="key", validatecommand=vcmd, width=5) self.entrySpeakSpeed.grid(row=10,column=2) self.entrySpeakSpeed.bind('<Return>', self.CallBackSetSpeed) self.buttonSpeedUp = Button(frame, text="Speed up", command=self.communicationProtocal.handleSpeedUp) self.buttonSpeedUp.grid(row = 10, column=3) Label(frame, text="voice:").grid(row = 11, column=0, padx=3, sticky=W) self.buttonPrevVoice = Button(frame, text="Prev voice", command=self.communicationProtocal.handlePrevVoice) self.buttonPrevVoice.grid(row = 12, column=0, padx=3, sticky=W) self.buttonNextVoice = Button(frame, text="Next voice", command=self.communicationProtocal.handleNextVoice) self.buttonNextVoice.grid(row = 12, column=3) self.currentVoice = StringVar(self.tkRoot) self.currentVoice.set(self.communicationProtocal.CurrentVoiceName) engine = pyttsx.init() voices = engine.getProperty("voices") voiceNames = list() for x in xrange(0, len(voices)): voiceNames.append(voices[x].name) self.optionMenuVoices = OptionMenu(frame, self.currentVoice, *tuple(voiceNames), command=self.CallBackOptionMenuVoices) self.optionMenuVoices.config(width=500) self.optionMenuVoices.grid(sticky=W, row = 12, column = 1) #hide if close button is clicked self.tkRoot.protocol("WM_DELETE_WINDOW", self.HideGui) self.tkRoot.after(1000/32, self.Update) self.tkRoot.mainloop()
class EngineGui(): def __init__(self, communicationProtocal): self.communicationProtocal = communicationProtocal def StartGui(self): self.tkRoot = Tk(baseName="") self.tkRoot.geometry("350x300+0+0") self.tkRoot.title("Engine SAPI GUI") self.GUIVisible = True frame = Frame(self.tkRoot) frame.style = Style() frame.style.theme_use("alt") frame.pack(fill=BOTH, expand=1) frame.columnconfigure(1, weight=1) frame.columnconfigure(7, pad=7) frame.rowconfigure(13, weight=1) frame.rowconfigure(13, pad=7) Label(frame, text="Start:").grid(row = 0, column=0) self.labelStart = Label(frame, text="0") self.labelStart.grid(row = 1, column=0) Label(frame, text="Length:").grid(row = 0, column=1) self.labelLength = Label(frame, text="0") self.labelLength.grid(row = 1, column=1) Label(frame, text="Total:").grid(row = 0, column=2) self.labelTotal = Label(frame, text="0") self.labelTotal.grid(row = 1, column=2) self.labelSentenceLeft = Label(frame, text="...") self.labelSentenceLeft.grid(row = 2, column=0, sticky=E) self.labelSentenceSpoken = Label(frame, text="...", foreground="red") self.labelSentenceSpoken.grid(row = 2, column=1) self.labelSentenceRight = Label(frame, text="...") self.labelSentenceRight.grid(row = 2, column=2, sticky=W, columnspan=2) scrollbar = Scrollbar(frame, orient=VERTICAL) self.labelQueueToSpeak = Label(frame, text="Queue to speak:").grid(row = 3, column=0, pady=4, padx=5, sticky=W) self.listboxQueueToSpeak = Listbox(frame, width=50, height=3, yscrollcommand=scrollbar.set) scrollbar.config(command=self.listboxQueueToSpeak.yview) self.listboxQueueToSpeak.grid( sticky=N+S+E+W, row = 4, column = 0, columnspan = 2 ,rowspan = 3, padx=3) scrollbar.grid(sticky=N+S+W, row = 4, column = 2, rowspan = 3) self.buttonPauze = Button(frame, text="Pauze", command=self.communicationProtocal.handlePauze) self.buttonPauze.grid(row = 4, column=3) self.buttonStop = Button(frame, text="Stop", command=self.communicationProtocal.restartProcess) self.buttonStop.grid(row = 5, column=3) self.buttonResume = Button(frame, text="Resume", command=self.communicationProtocal.handleResume) self.buttonResume.grid(row = 6, column=3) Label(frame, text="Text to say:").grid(row = 7, column=0, padx=3, sticky=W) self.stringVarTextToSay = StringVar() self.entryTextToSay = Entry(frame, textvariable=self.stringVarTextToSay, width=500) self.entryTextToSay.grid(row=8, column=0, columnspan=3, padx=3, sticky=W) self.stringVarTextToSay.set("Hello SAPI Speak Engine") self.entryTextToSay.bind('<Return>', self.CallBackReturnSay) self.buttonSay = Button(frame, text="Say", command=self.CallBackButtonSay) self.buttonSay.grid(row = 8, column=3) Label(frame, text="Recover action:").grid(row = 9, column=0, padx=3, sticky=W) self.recoverActionLabelText = "None" self.labelRecoverAction = Label(frame, text=self.recoverActionLabelText, foreground="blue") self.labelRecoverAction.grid(row = 10, column=0) Label(frame, text="Voice speed:").grid(row = 9, column=1, sticky=W) self.buttonSpeedDown = Button(frame, text="Speed down", command=self.communicationProtocal.handleSpeedDown) self.buttonSpeedDown.grid(row = 10, column=1, padx=3, sticky=E) self.speedValue = 0 self.intVarSpeed = IntVar() vcmd = (self.tkRoot.register(self.OnValidateEntrySpeakSpeed), '%d', '%i', '%P', '%s', '%S', '%v', '%V', '%W') self.entrySpeakSpeed = Entry(frame, textvariable=self.intVarSpeed, validate="key", validatecommand=vcmd, width=5) self.entrySpeakSpeed.grid(row=10,column=2) self.entrySpeakSpeed.bind('<Return>', self.CallBackSetSpeed) self.buttonSpeedUp = Button(frame, text="Speed up", command=self.communicationProtocal.handleSpeedUp) self.buttonSpeedUp.grid(row = 10, column=3) Label(frame, text="voice:").grid(row = 11, column=0, padx=3, sticky=W) self.buttonPrevVoice = Button(frame, text="Prev voice", command=self.communicationProtocal.handlePrevVoice) self.buttonPrevVoice.grid(row = 12, column=0, padx=3, sticky=W) self.buttonNextVoice = Button(frame, text="Next voice", command=self.communicationProtocal.handleNextVoice) self.buttonNextVoice.grid(row = 12, column=3) self.currentVoice = StringVar(self.tkRoot) self.currentVoice.set(self.communicationProtocal.CurrentVoiceName) engine = pyttsx.init() voices = engine.getProperty("voices") voiceNames = list() for x in xrange(0, len(voices)): voiceNames.append(voices[x].name) self.optionMenuVoices = OptionMenu(frame, self.currentVoice, *tuple(voiceNames), command=self.CallBackOptionMenuVoices) self.optionMenuVoices.config(width=500) self.optionMenuVoices.grid(sticky=W, row = 12, column = 1) #hide if close button is clicked self.tkRoot.protocol("WM_DELETE_WINDOW", self.HideGui) self.tkRoot.after(1000/32, self.Update) self.tkRoot.mainloop() def Update(self): wordLocation = self.communicationProtocal.OnWordStartLocation wordLength = self.communicationProtocal.OnWordLength wordTotal = self.communicationProtocal.OnWordTotal if wordLocation: self.labelStart.configure(text=wordLocation) else: self.labelStart.configure(text="0") self.labelLength.configure(text=wordLength) if wordLength != 0 and wordTotal == 0: self.labelTotal.configure(text="Introduce") else: self.labelTotal.configure(text=wordTotal) if len(self.communicationProtocal.SpeakQueue) != 0: if (wordLocation < 25): self.labelSentenceLeft.configure(text=str(self.communicationProtocal.SpeakQueue[0])[0:wordLocation]) else: self.labelSentenceLeft.configure(text=str(self.communicationProtocal.SpeakQueue[0])[wordLocation-25:wordLocation]) self.labelSentenceSpoken.configure(text=str(self.communicationProtocal.SpeakQueue[0])[wordLocation:wordLocation+wordLength]) if (wordTotal - wordLocation - wordLength < 25): self.labelSentenceRight.configure(text=str(self.communicationProtocal.SpeakQueue[0])[wordLocation+wordLength:wordTotal]) else: self.labelSentenceRight.configure(text=str(self.communicationProtocal.SpeakQueue[0])[wordLocation+wordLength:wordLocation+wordLength+25]) else: self.labelSentenceLeft.configure(text="...") self.labelSentenceSpoken.configure(text="...") self.labelSentenceRight.configure(text="...") if (self.communicationProtocal.SpeakQueue != None and self.listboxQueueToSpeak.size() != len(self.communicationProtocal.SpeakQueue)): self.listboxQueueToSpeak.delete(0,self.listboxQueueToSpeak.size()) for x in xrange(0,len(self.communicationProtocal.SpeakQueue)): self.listboxQueueToSpeak.insert(x, str(x)+": "+self.communicationProtocal.SpeakQueue[x]) if (self.currentVoice.get() != self.communicationProtocal.CurrentVoiceName): self.currentVoice.set(self.communicationProtocal.CurrentVoiceName) if self.speedValue != self.communicationProtocal.CurrentRate: self.intVarSpeed.set(self.communicationProtocal.CurrentRate) self.speedValue = self.communicationProtocal.CurrentRate if self.recoverActionLabelText != self.communicationProtocal.recoveryTask: self.recoverActionLabelText = self.communicationProtocal.recoveryTask self.labelRecoverAction.configure(text=self.recoverActionLabelText) if self.GUIVisible != self.communicationProtocal.GUIVisible: # self.GUIVisible ? self.HideGui : self.ShowGui self.HideGui() if self.GUIVisible else self.ShowGui() self.tkRoot.after(1000/32,self.Update) def OnValidateEntrySpeakSpeed(self, d, i, P, s, S, v, V, W): try : int(S) return True except ValueError: return False def CallBackSetSpeed(self): self.communicationProtocal.handleSetSpeed(self.intVarSpeed.get()) def CallBackReturnSay(self, event): self.CallBackButtonSay() def CallBackButtonSay(self): self.communicationProtocal.handleSay(self.stringVarTextToSay.get()) def CallBackOptionMenuVoices(self, selectedItem): self.communicationProtocal.handleSetVoice(selectedItem) def Close(self): self.tkRoot.quit() def HideGui(self): self.GUIVisible = False self.communicationProtocal.GUIVisible = False self.tkRoot.withdraw() def ShowGui(self): self.GUIVisible = True self.communicationProtocal.GUIVisible = True self.tkRoot.deiconify()