Self.LOCAL_ERROR_LOG( str(_CMD)+" | "+str(_err) ) įor _key in self. Self.LOCAL_INFO_LOG( "notebook:notes:keep_open:"+_CMD ) Self.KEEP_OPEN = True if _CMD = "1" else False Self.UPDATE_TIMER.singleShot( 1000, self.UPDATE_FRAME ) Self.LOG_TAG = str(self._class_._name_).upper() ('Edit this word and save to your dictionary.')įor i, d in enumerate(self.dictionaries): nnect(self.add_button, SIGNAL("clicked()"), self.save_word) Self.disconnect(self.add_button, SIGNAL("clicked()"), self.add_word) ('Word %s has been added successfully.' % Translation=translation, phoneme=phoneme, pos=pos, Return dict(dictionary=current_dict, original=original, "'Original', 'Translation' and 'Parts of " QMessageBox.critical(self, "Error", "You must enter at least " Synonyms = unicode(()).strip()Īntonyms = unicode(()).strip()ĭescription = unicode(()).strip() nnect(self.add_button, SIGNAL("clicked()"), self.add_word)Ĭurrent_(',') if len(p) > 0])Ĭurrent_dict = nnect(self.close_button, SIGNAL("clicked()"), self.close) nnect(self.dictionary, SIGNAL("currentIndexChanged(int)"), Self.status = QLabel('Add a new word to a dictionary.')
Self.close_button = QPushButton("&Close") Vbox.addWidget(QLabel("Parts of Speech")) Super(AddWordWidget, self)._init_(parent=parent) "File " + file_name + " written to disk", ("\nRunning script:\n")įile_name = QFileDialog.getSaveFileName(self, "Save File to Disk", ".", "*.py")įile.write(str(())) Gui.button(button_box, self, "Save Script to File", callback=self.save_script, height=35) Gui.button(button_box, self, "Run Script", callback=self.execute_script, height=35) nsole = PythonConsole(self._dict_, self)Ĭonsole_box.layout().addWidget(nsole)īutton_box = oasysgui.widgetBox(script_box, "", addSpace=False, orientation="horizontal") Script_box.layout().addWidget(self.pythonScript)Ĭonsole_box = oasysgui.widgetBox(script_box, "", addSpace=False, orientation="vertical", height=150, width=750) Script_box = oasysgui.widgetBox(self, "", addSpace=False, orientation="vertical", height=545, width=750) Plain TextĮnter the above text in order in the line editer and use the enter key to add it to the text (False) # asked by Manolo def clear_text(self):Ĭlear_text a method is called, it will use the clear method to remove the text that was in the text browser (self.tb). When text is added to the text browser, the clear method is used to remove the text in the line editer. def append_text(self):Īppend_text method functions to append text (self.le.text()) written to the line finder to the text browser (self.tb). self.clear_btn = QPushButton('Clear')Ĭlear_btn, the clear_text method is called. SetOpenExternalLinks() to True to connect to external links. This is because it is True by default, so you don't need to. If you set SetAcceptRichText() to True, you can use Rich text. Using the QTextBrowser() class, we created a text browser. When you press Enter, append_text method is called.
The line editor and text browser appear in the window. , QLineEdit, QTextBrowser, QPushButton, QVBoxLayout) import sysįrom PyQt5.QtWidgets import (QApplication, QWidget You can use QLabel to display short rich text.
None (the default) uses Qt's auto detection.
plaintext: Whether to force plain text (True) or rich text (False). buttons: The buttons to set (QMessageBox::StandardButtons) onfinished: A slot to connect to the 'finished' signal.
PYQT PLAIN TEXT EDITOR HOW TO
The demo below shows how to use the QTextBrowser widget in Python PyQt. Args: parent: The parent to set for the message box. Related course: Create Desktop Apps with Python PyQt5 QTextBrowser It also allows QTextEdit to be setReadOnly() to make editing impossible to use a text browser that does not have hypertext navigation. To use an editable rich text editor, you must use QTextEdit. This class is read-only and can use links in hypertext documents as an extension of QTextEdit. The QTextBrowser class provides a rich text (rich text) browser that includes hypertext navigation.