

'Text files (*.txt) HTML files (*.html)') MeshMenu.addAction(self.add_sphere_action) Self.add_sphere_action = QAction('Add Sphere', self) #you can add many items on menu with actions for each item #create the menu with the text File, add the exit action (self.my_OpenDialog)ĮxitAct = QAction(QIcon('exit.png'), '&Exit', self) OpenAct = QAction(QIcon('open.png'), '&Open', self)

Self.editor_tHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) Self.editor_tVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) tWindowTitle("parse sensors output - catafest") #you can add new action for File menu and any actions you need #create the action for the exit application with shortcut and icon #create the init UI to draw the application # top left of rectangle becomes top left of window centering it # move rectangle's center point to screen's center point #create the def center to select the center of the screenĬp = QDesktopWidget().availableGeometry().center() Size_tVerticalPolicy(QSizePolicy.Preferred)

#init the example class to draw the window application
Qt plain text editor code#
The source code is simple to understand and is commented for a better understanding.įrom PyQt5.QtWidgets import QMainWindow, QAction, qApp, QApplication, QDesktopWidgetįrom PyQt5.QtWidgets import QMenu, QPlainTextEdit, QSizePolicy The next step was to use QPlainTextEdit so the task was simple: an editor.īecause I created another article about a publisher, see this tutorial, I decided to attach a main menu with submenus and customize it. Installing collected packages: PyQt5-sip, PyQt5 Today I installed Python 3.8.3 and my favorite PyQt5 and started to see how much I forgot from what I knew.ĭownloading PyQt5-5.14.2-5.14.38-none-win_amd64.whl (52.9 MB)
