我们从Python开源项目中,提取了以下49个代码示例,用于说明如何使用PyQt5.QtWidgets.QTextEdit()。
def PopulateForm(self): layout = QVBoxLayout() label = QtWidgets.QLabel() label.setText("Notes about sample %s" % idc.GetInputMD5()) self.editor = QtWidgets.QTextEdit() self.editor.setFontFamily(self.skel_settings.notepad_font_name) self.editor.setFontPointSize(self.skel_settings.notepad_font_size) text = self.skel_conn.get_abstract() self.editor.setPlainText(text) # editor.setAutoFormatting(QtWidgets.QTextEdit.AutoAll) self.editor.textChanged.connect(self._onTextChange) layout.addWidget(label) layout.addWidget(self.editor) self.setLayout(layout)
def __init__(self, link_url: str, dl_path: str, parent=None): super(Downloader, self).__init__(parent) self.parent = parent self.dltool_cmd = find_executable(self.download_cmd) self.download_link = link_url self.download_path = dl_path if self.dltool_cmd.strip(): self.dltool_args = self.dltool_args.format(dl_path=self.download_path, dl_link=self.download_link) self.console = QTextEdit(self.parent) self.console.setWindowTitle('%s Downloader' % qApp.applicationName()) self.proc = QProcess(self.parent) layout = QVBoxLayout() layout.addWidget(self.console) self.setLayout(layout) self.setFixedSize(QSize(400, 300)) else: QMessageBox.critical(self.parent, 'DOWNLOADER ERROR', '<p>The <b>aria2c</b> executable binary could not ' + 'be found in your installation folders. The binary comes packaged with this ' + 'application so it is likely that it was accidentally deleted via human ' + 'intervntion or incorrect file permissions are preventing access to it.</p>' + '<p>You may either download and install <b>aria2</b> manually yourself, ensuring ' + 'its installation location is globally accessible via PATH environmnt variables or ' + 'simply reinstall this application again. If the issue is not resolved then try ' + 'to download the application again incase the orignal you installed already was ' + 'corrupted/broken.', buttons=QMessageBox.Close)
def __init__( self, app, title ): super().__init__( app, title ) self.code_font = self.app.getCodeFont() self.text_edit = QtWidgets.QTextEdit() self.layout = QtWidgets.QVBoxLayout() self.layout.addWidget( self.text_edit ) self.setLayout( self.layout ) self.all_text_formats = {} for style, fg_colour, bg_colour in self.all_style_colours: char_format = QtGui.QTextCharFormat() char_format.setFont( self.code_font ) char_format.setForeground( QtGui.QBrush( QtGui.QColor( str(fg_colour) ) ) ) char_format.setBackground( QtGui.QBrush( QtGui.QColor( str(bg_colour) ) ) ) self.all_text_formats[ style ] = char_format self.text_edit.setReadOnly( True ) em = self.app.fontMetrics().width( 'm' ) ex = self.app.fontMetrics().lineSpacing() self.resize( 130*em, 45*ex )
def __init__(self, name, parent=None): super(Chatter, self).__init__(parent) self.name = name self.text_panel = QtWidgets.QTextEdit() self.text_panel.setReadOnly(True) self.input = QtWidgets.QLineEdit() layout = QtWidgets.QVBoxLayout() layout.addWidget(self.text_panel, 3) layout.addWidget(self.input, 1) self.setLayout(layout) self.setWindowTitle("Chatter") self.input.editingFinished.connect(self.input_changed) self.input.setFocus() self.chattery = nw0.discover("chattery/news") self.responder = FeedbackReader(self.chattery) self.responder.message_received.connect(self.handle_response) self.responder.start()
def __init__(self, parent=None): super(AddressBook, self).__init__(parent) nameLabel = QLabel("Name:") self.nameLine = QLineEdit() addressLabel = QLabel("Address:") self.addressText = QTextEdit() mainLayout = QGridLayout() mainLayout.addWidget(nameLabel, 0, 0) mainLayout.addWidget(self.nameLine, 0, 1) mainLayout.addWidget(addressLabel, 1, 0, Qt.AlignTop) mainLayout.addWidget(self.addressText, 1, 1) self.setLayout(mainLayout) self.setWindowTitle("Simple Address Book")
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(564, 270) self.centralWidget = QtWidgets.QWidget(MainWindow) self.centralWidget.setObjectName("centralWidget") self.pushButton = QtWidgets.QPushButton(self.centralWidget) self.pushButton.setGeometry(QtCore.QRect(320, 60, 93, 28)) self.pushButton.setObjectName("pushButton") self.textEdit = QtWidgets.QTextEdit(self.centralWidget) self.textEdit.setGeometry(QtCore.QRect(60, 60, 151, 31)) self.textEdit.setObjectName("textEdit") self.pushButton_2 = QtWidgets.QPushButton(self.centralWidget) self.pushButton_2.setGeometry(QtCore.QRect(320, 150, 111, 28)) self.pushButton_2.setObjectName("pushButton_2") self.label = QtWidgets.QLabel(self.centralWidget) self.label.setGeometry(QtCore.QRect(60, 30, 151, 16)) self.label.setObjectName("label") self.label_2 = QtWidgets.QLabel(self.centralWidget) self.label_2.setGeometry(QtCore.QRect(60, 110, 151, 41)) self.label_2.setObjectName("label_2") self.comboBox = QtWidgets.QComboBox(self.centralWidget) self.comboBox.setGeometry(QtCore.QRect(60, 160, 87, 22)) self.comboBox.setObjectName("comboBox") MainWindow.setCentralWidget(self.centralWidget) self.menuBar = QtWidgets.QMenuBar(MainWindow) self.menuBar.setGeometry(QtCore.QRect(0, 0, 564, 26)) self.menuBar.setObjectName("menuBar") MainWindow.setMenuBar(self.menuBar) self.mainToolBar = QtWidgets.QToolBar(MainWindow) self.mainToolBar.setObjectName("mainToolBar") MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.mainToolBar) self.statusBar = QtWidgets.QStatusBar(MainWindow) self.statusBar.setObjectName("statusBar") MainWindow.setStatusBar(self.statusBar) self.comboBox.addItems(["%s" % x for x in range(1, 100)]) self.pushButton.clicked.connect(self.start) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def initUI(self): textEdit = QTextEdit() self.setCentralWidget(textEdit) exitAction = QAction(QIcon('exit24.png'), 'Exit', self) exitAction.setShortcut('Ctrl+Q') exitAction.setStatusTip('Exit application') exitAction.triggered.connect(self.close) self.statusBar() menubar = self.menuBar() fileMenu = menubar.addMenu('&File') fileMenu.addAction(exitAction) toolbar = self.addToolBar('Exit') toolbar.addAction(exitAction) self.setGeometry(300, 300, 350, 250) self.setWindowTitle('Main window') self.show()
def init_widget(self): self.setWindowTitle("Hello World") widget_laytout = QBoxLayout(QBoxLayout.LeftToRight) group = QGroupBox() box = QBoxLayout(QBoxLayout.TopToBottom) group.setLayout(box) group.setTitle("Buttons") widget_laytout.addWidget(group) fruits = ["Buttons in GroupBox", "TextBox in GroupBox", "Label in GroupBox", "TextEdit"] view = QListView(self) model = QStandardItemModel() for f in fruits: model.appendRow(QStandardItem(f)) view.setModel(model) box.addWidget(view) self.stk_w.addWidget(Widget_1()) self.stk_w.addWidget(Widget_2()) self.stk_w.addWidget(Widget_3()) self.stk_w.addWidget(QTextEdit()) widget_laytout.addWidget(self.stk_w) self.setLayout(widget_laytout) # ??? ?? ?? view.clicked.connect(self.slot_clicked_item)
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(247, 195) self.verticalLayout = QtWidgets.QVBoxLayout(Dialog) self.verticalLayout.setObjectName("verticalLayout") self.edit_text = QtWidgets.QTextEdit(Dialog) self.edit_text.setObjectName("edit_text") self.verticalLayout.addWidget(self.edit_text) self.buttonBox = QtWidgets.QDialogButtonBox(Dialog) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) self.buttonBox.setCenterButtons(True) self.buttonBox.setObjectName("buttonBox") self.verticalLayout.addWidget(self.buttonBox) self.retranslateUi(Dialog) self.buttonBox.accepted.connect(Dialog.accept) self.buttonBox.rejected.connect(Dialog.reject) QtCore.QMetaObject.connectSlotsByName(Dialog)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(391, 242) MainWindow.setMinimumSize(QtCore.QSize(391, 242)) MainWindow.setMaximumSize(QtCore.QSize(391, 242)) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.textEdit = QtWidgets.QTextEdit(self.centralwidget) self.textEdit.setGeometry(QtCore.QRect(0, 0, 391, 241)) self.textEdit.setMinimumSize(QtCore.QSize(391, 0)) self.textEdit.setLineWrapMode(QtWidgets.QTextEdit.WidgetWidth) self.textEdit.setReadOnly(False) self.textEdit.setCursorWidth(1) self.textEdit.setObjectName("textEdit") MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def layout(self): """ Lay out the dialog. """ main_layout = QW.QVBoxLayout(self) test_layout = QW.QHBoxLayout() button_layout = QW.QVBoxLayout() self._fitter_select = QW.QListWidget() self._fitter_select.setSelectionMode(QW.QAbstractItemView.ExtendedSelection) for k,v in self._fit_snapshot_dict.items(): self._fitter_select.addItem(k) self._fitter_select.setFixedSize(150, 100) ftest_button = QW.QPushButton("Perform AIC Test", self) ftest_button.clicked.connect(self.perform_test) add_fit_button = QW.QPushButton("Append New Fit", self) add_fit_button.clicked.connect(self.add_fitter) self._data_out = QW.QTextEdit() self._data_out.setReadOnly(True) self._data_out.setMinimumWidth(400) # add buttons to layout button_layout.addWidget(ftest_button) button_layout.addWidget(add_fit_button) # add widgets to layout test_layout.addWidget(self._fitter_select) test_layout.addLayout(button_layout) main_layout.addLayout(test_layout) main_layout.addWidget(self._data_out) self.setWindowTitle('AIC Test')
def __init__( self, dialog, name, present, value ): SingleProperty.__init__( self, dialog, name, present ) value_ctrl = QtWidgets.QTextEdit() value_ctrl.setAcceptRichText( False ) value_ctrl.setText( value ) value_ctrl.setMinimumWidth( 400 ) value_ctrl.setMinimumHeight( 200 ) self.setValueCtrl( value_ctrl, value )
def __init__(self, parent=None): super(Adventure, self).__init__(parent) # # Top-half of the # self.image_panel = QtWidgets.QLabel() self.image_panel.setAlignment(QtCore.Qt.AlignCenter) self.image = QtGui.QPixmap("image.jpg") self.image_panel.setPixmap(self.image) self.text_panel = QtWidgets.QTextEdit() self.text_panel.setReadOnly(True) self.text_panel.setTextBackgroundColor(QtGui.QColor("blue")) self.text_panel.setHtml("""<h1>Hello, World!</h1> <p>You are in a spacious ballroom with the sound of music playing all around you.</p> """) self.data_panel = QtWidgets.QTextEdit() self.data_panel.setReadOnly(True) self.input = QtWidgets.QLineEdit() layout = QtWidgets.QVBoxLayout() layout.addWidget(self.image_panel, 1) hlayout = QtWidgets.QHBoxLayout() hlayout.addWidget(self.text_panel, 3) hlayout.addWidget(self.data_panel, 1) layout.addLayout(hlayout, 1) layout.addWidget(self.input) self.setLayout(layout) self.setWindowTitle("Westpark Adventure")
def __init__(self): super().__init__() self.text = QTextEdit(self) self.clr_btn = QPushButton('Clear') self.sav_btn = QPushButton('Save') self.opn_btn = QPushButton('Open') self.font_btn = QPushButton('Change Font') self.init_ui()
def __init__(self): super(Notepad, self).__init__() self.text = QTextEdit(self) self.clr_btn = QPushButton('Clear') self.init_ui()
def __init__(self): super(Notepad, self).__init__() self.text = QTextEdit(self) self.clr_btn = QPushButton('Clear') self.sav_btn = QPushButton('Save') self.opn_btn = QPushButton('Open') self.init_ui()
def __init__(self): super(Notepad, self).__init__() self.text = QTextEdit(self) self.clr_btn = QPushButton('Save') self.init_ui()
def __init__(self): super().__init__() self.text = QTextEdit(self) self.clr_btn = QPushButton('Clear') self.sav_btn = QPushButton('Save') self.opn_btn = QPushButton('Open') self.font_btn = QPushButton('Change Font') # self.clr_btn.setStyle(QStyleFactory.create('Fusion')) # self.sav_btn.setStyle(QStyleFactory.create('Windows')) # self.opn_btn.setStyle(QStyleFactory.create('Cleanlooks')) self.init_ui()
def __init__(self, parent=None): super(VideoConsole, self).__init__(parent) self._buffer = StringIO() self.setReadOnly(True) self.setWordWrapMode(QTextOption.NoWrap) self.setStyleSheet('QTextEdit { font-family:monospace; font-size:%s; }' % ('10pt' if sys.platform == 'darwin' else '8pt'))
def focusInEvent(self, event): """ QTextEdit focusInEvent Necessary to avoid Qt errors """ self.completer.setWidget(self) super().focusInEvent(event)
def setupUi(self, chatBox,message): chatBox.setObjectName("chatBox") chatBox.resize(473, 294) self.gridLayout = QtWidgets.QGridLayout(chatBox) self.gridLayout.setObjectName("gridLayout") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.chatLabel = QtWidgets.QLabel(chatBox) self.chatLabel.setObjectName("chatLabel") self.verticalLayout.addWidget(self.chatLabel) self.userChat = chatText(chatBox) self.userChat.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) self.userChat.setObjectName("userChat") self.verticalLayout.addWidget(self.userChat) self.gridLayout.addLayout(self.verticalLayout, 1, 0, 4, 1) self.chat = QtWidgets.QTextEdit(chatBox) self.chat.setEnabled(True) self.chat.setReadOnly(True) self.chat.setObjectName("chat") self.gridLayout.addWidget(self.chat, 0, 0, 1, 2) self.listOnline = QtWidgets.QPushButton(chatBox) self.listOnline.setObjectName("listOnline") self.gridLayout.addWidget(self.listOnline, 1, 1, 1, 1) self.sendButton = QtWidgets.QPushButton(chatBox) self.sendButton.setObjectName("sendButton") self.gridLayout.addWidget(self.sendButton, 3, 1, 1, 1) self.exitButton = QtWidgets.QPushButton(chatBox) self.exitButton.setObjectName("exitButton") self.gridLayout.addWidget(self.exitButton, 4, 1, 1, 1) self.fileSendButton = QtWidgets.QPushButton(chatBox) self.fileSendButton.setObjectName("fileSendButton") self.gridLayout.addWidget(self.fileSendButton, 2, 1, 1, 1) self.retranslateUi(chatBox,message) QtCore.QMetaObject.connectSlotsByName(chatBox)
def setupUi(self, chatBox,message): chatBox.setObjectName("chatBox") chatBox.resize(473, 294) self.gridLayout = QtWidgets.QGridLayout(chatBox) self.gridLayout.setObjectName("gridLayout") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.chatLabel = QtWidgets.QLabel(chatBox) self.chatLabel.setObjectName("chatLabel") self.verticalLayout.addWidget(self.chatLabel) self.userChat = QtWidgets.QTextEdit(chatBox) self.userChat.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) self.userChat.setObjectName("userChat") self.verticalLayout.addWidget(self.userChat) self.gridLayout.addLayout(self.verticalLayout, 1, 0, 4, 1) self.chat = QtWidgets.QTextEdit(chatBox) self.chat.setEnabled(True) self.chat.setReadOnly(True) self.chat.setObjectName("chat") self.gridLayout.addWidget(self.chat, 0, 0, 1, 2) self.listOnline = QtWidgets.QPushButton(chatBox) self.listOnline.setObjectName("listOnline") self.gridLayout.addWidget(self.listOnline, 1, 1, 1, 1) self.sendButton = QtWidgets.QPushButton(chatBox) self.sendButton.setObjectName("sendButton") self.gridLayout.addWidget(self.sendButton, 3, 1, 1, 1) self.exitButton = QtWidgets.QPushButton(chatBox) self.exitButton.setObjectName("exitButton") self.gridLayout.addWidget(self.exitButton, 4, 1, 1, 1) self.fileSendButton = QtWidgets.QPushButton(chatBox) self.fileSendButton.setObjectName("fileSendButton") self.gridLayout.addWidget(self.fileSendButton, 2, 1, 1, 1) self.retranslateUi(chatBox,message) self.exitButton.clicked.connect(chatBox.close) self.sendButton.clicked.connect(self.userChat.clear) self.fileSendButton.clicked.connect(self.userChat.clear) QtCore.QMetaObject.connectSlotsByName(chatBox)
def init(self): self.cpus=multiprocessing.cpu_count() self.tab.setTabsClosable(True) self.tab.setMovable(True) self.tab.setTabBar(QHTabBar()) self.tab.setTabPosition(QTabWidget.West) self.font = QFont() self.font.setFamily('Monospace') self.font.setStyleHint(QFont.Monospace) self.font.setFixedPitch(True) self.font.setPointSize(int(12)) self.terminals=[] self.process=[] for i in range(0,self.cpus): term=QTextEdit() term.setFont(self.font) pal = QPalette() bgc = QColor(0, 0, 0) pal.setColor(QPalette.Base, bgc) textc = QColor(230, 230, 230) pal.setColor(QPalette.Text, textc) term.setPalette(pal) proc=QProcess(self) proc.readyRead.connect(functools.partial(self.dataReady,i)) self.process.append(proc) self.terminals.append(term) self.tab.addTab(term,_("CPU")+" "+str(i)) if enable_betafeatures()==True: self.cluster=hpc_class() self.tab.addTab(self.cluster,_("Cluster")) global_object_register("cluster_tab",self.cluster)
def __init__(self): super(QWidget, self).__init__() layout = QVBoxLayout() self.edit = QTextEdit() self.thread = QThread() self.setupConnections() self.edit.setWindowTitle("QTextEdit Standard Output Redirection") layout.addWidget(self.edit) self.setLayout(layout) self.show()
def main(): application = QtWidgets.QApplication([]) window = QtWidgets.QWidget() layout_numbers = QtWidgets.QVBoxLayout(window) result = QtWidgets.QTextEdit() layout_numbers.addWidget(result) # Numbers from 0 to 9, Numeros de 0 a 9 for number in range(10): button = QtWidgets.QPushButton(str(number)) button.clicked.connect(lambda _, number=number: result.insertPlainText(str(number))) layout_numbers.addWidget(button) # Math Operators, Operadores Matematicos operators = QtWidgets.QWidget() layout_operators = QtWidgets.QHBoxLayout(operators) for operator in ("*", "/", "+", "-", "//"): button = QtWidgets.QPushButton(str(operator)) button.clicked.connect(lambda _, operator=operator: result.insertPlainText(str(operator))) layout_operators.addWidget(button) layout_numbers.addWidget(operators) # Solve the user input, Resolver lo ingresado por el usuario solve = QtWidgets.QPushButton("EVAL", window) solve.clicked.connect(lambda _, maths=result: result.setPlainText(str(eval(maths.toPlainText())))) layout_numbers.addWidget(solve) window.show() exit(application.exec_())
def init_ui(self): self.setWindowTitle(_('Start times')) self.setWindowIcon(QIcon(config.ICON)) self.setSizeGripEnabled(False) self.setModal(True) self.layout = QFormLayout(self) self.text = QTextEdit() self.text.setMinimumHeight(450) self.text.setMinimumWidth(450) self.text.setMaximumHeight(450) self.layout.addRow(self.text) self.set_text() def cancel_changes(): self.close() def apply_changes(): try: self.apply_changes_impl() except Exception as e: logging.exception(str(e)) self.close() self.button_ok = QPushButton(_('Save to file')) self.button_ok.clicked.connect(apply_changes) self.button_cancel = QPushButton(_('Cancel')) self.button_cancel.clicked.connect(cancel_changes) self.layout.addRow(self.button_ok, self.button_cancel) self.show()
def setup_ui(self): self.setAcceptDrops(False) self.setLayoutDirection(QtCore.Qt.LeftToRight) self.setAutoFillBackground(False) self.layout = QtWidgets.QGridLayout(self) self.textEdit = QtWidgets.QTextEdit(self) self.textEdit.setLineWrapMode(QtWidgets.QTextEdit.NoWrap) self.textEdit.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse) self.layout.addWidget(self.textEdit)
def setupUi(self, window): window.setObjectName("window") window.resize(380, 477) window.setModal(True) self.verticalLayout = QtWidgets.QVBoxLayout(window) self.verticalLayout.setObjectName("verticalLayout") self.txt_list = QtWidgets.QTextEdit(window) self.txt_list.setMinimumSize(QtCore.QSize(183, 0)) self.txt_list.setAcceptRichText(False) self.txt_list.setObjectName("txt_list") self.verticalLayout.addWidget(self.txt_list) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setContentsMargins(-1, -1, -1, 10) self.horizontalLayout.setObjectName("horizontalLayout") self.btn_cancel = QtWidgets.QPushButton(window) self.btn_cancel.setAutoDefault(False) self.btn_cancel.setObjectName("btn_cancel") self.horizontalLayout.addWidget(self.btn_cancel) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.btn_ok = QtWidgets.QPushButton(window) self.btn_ok.setAutoDefault(True) self.btn_ok.setObjectName("btn_ok") self.horizontalLayout.addWidget(self.btn_ok) self.verticalLayout.addLayout(self.horizontalLayout) self.retranslateUi(window) QtCore.QMetaObject.connectSlotsByName(window)
def setupUi(self, SchemaMainWindow): SchemaMainWindow.setObjectName("SchemaMainWindow") SchemaMainWindow.resize(417, 594) self.centralwidget = QtWidgets.QWidget(SchemaMainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout.setObjectName("gridLayout") self.schemaLabel = QtWidgets.QLabel(self.centralwidget) self.schemaLabel.setObjectName("schemaLabel") self.gridLayout.addWidget(self.schemaLabel, 0, 0, 1, 2) self.schemaSelection = QtWidgets.QComboBox(self.centralwidget) self.schemaSelection.setObjectName("schemaSelection") self.gridLayout.addWidget(self.schemaSelection, 0, 2, 1, 2) self.schemaView = QtWidgets.QTextBrowser(self.centralwidget) self.schemaView.setObjectName("schemaView") self.gridLayout.addWidget(self.schemaView, 1, 0, 1, 4) self.instanceLabel = QtWidgets.QLabel(self.centralwidget) self.instanceLabel.setObjectName("instanceLabel") self.gridLayout.addWidget(self.instanceLabel, 2, 0, 1, 2) self.instanceSelection = QtWidgets.QComboBox(self.centralwidget) self.instanceSelection.setObjectName("instanceSelection") self.gridLayout.addWidget(self.instanceSelection, 2, 2, 1, 2) self.instanceEdit = QtWidgets.QTextEdit(self.centralwidget) self.instanceEdit.setObjectName("instanceEdit") self.gridLayout.addWidget(self.instanceEdit, 3, 0, 1, 4) self.label = QtWidgets.QLabel(self.centralwidget) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 4, 0, 1, 1) self.validationStatus = QtWidgets.QLabel(self.centralwidget) self.validationStatus.setObjectName("validationStatus") self.gridLayout.addWidget(self.validationStatus, 4, 1, 1, 2) self.validateButton = QtWidgets.QPushButton(self.centralwidget) self.validateButton.setObjectName("validateButton") self.gridLayout.addWidget(self.validateButton, 4, 3, 1, 1) SchemaMainWindow.setCentralWidget(self.centralwidget) self.statusbar = QtWidgets.QStatusBar(SchemaMainWindow) self.statusbar.setObjectName("statusbar") SchemaMainWindow.setStatusBar(self.statusbar) self.retranslateUi(SchemaMainWindow) QtCore.QMetaObject.connectSlotsByName(SchemaMainWindow)
def __init__(self, parent=None): super(AddressBook, self).__init__(parent) self.contacts = SortedDict() self.oldName = '' self.oldAddress = '' nameLabel = QLabel("Name:") self.nameLine = QLineEdit() self.nameLine.setReadOnly(True) addressLabel = QLabel("Address:") self.addressText = QTextEdit() self.addressText.setReadOnly(True) self.addButton = QPushButton("&Add") self.addButton.show() self.submitButton = QPushButton("&Submit") self.submitButton.hide() self.cancelButton = QPushButton("&Cancel") self.cancelButton.hide() self.addButton.clicked.connect(self.addContact) self.submitButton.clicked.connect(self.submitContact) self.cancelButton.clicked.connect(self.cancel) buttonLayout1 = QVBoxLayout() buttonLayout1.addWidget(self.addButton, Qt.AlignTop) buttonLayout1.addWidget(self.submitButton) buttonLayout1.addWidget(self.cancelButton) buttonLayout1.addStretch() mainLayout = QGridLayout() mainLayout.addWidget(nameLabel, 0, 0) mainLayout.addWidget(self.nameLine, 0, 1) mainLayout.addWidget(addressLabel, 1, 0, Qt.AlignTop) mainLayout.addWidget(self.addressText, 1, 1) mainLayout.addLayout(buttonLayout1, 1, 2) self.setLayout(mainLayout) self.setWindowTitle("Simple Address Book")
def __initUI(self): """Initialize the UI""" self.__layout = QtWidgets.QVBoxLayout() self.__console = QtWidgets.QTextEdit(self) self.__console.setFont(QtGui.QFont("Ubuntu Mono")) self.__console.setMinimumWidth(400) self.__console.setMinimumHeight(100) self.__console.setReadOnly(True) self.__layout.addWidget(self.__console) self.setLayout(self.__layout) with open(Resources.consoleStyle, "r") as CSS: self.__console.setStyleSheet(CSS.read()) # Connect Signals self.readStdout.connect(self.printToConsole)
def __init__(self, parent, config, is_stream=False, trace=None): self.parent = parent self.configuration = config self.broker = Broker() self.result_widget = QtWidgets.QTextEdit() self.is_stream = is_stream self.trace_input_generator = None self.analyse_finished = False self.trace_finished = False if not is_stream and trace is not None: self.trace_input_generator = raw_parse_trace(trace.filename)
def __init__(self): QWidget.__init__(self, flags=Qt.Widget) self.te = QTextEdit() self.pb = QPushButton("Connect") self.pb_send = QPushButton("Send") self.serial = SerialController() self.init_widget()
def init_widget(self): self.setWindowTitle("Hello World") form_lbx = QBoxLayout(QBoxLayout.TopToBottom, parent=self) self.setLayout(form_lbx) te = QTextEdit() form_lbx.addWidget(te)
def init_widget(self): self.setWindowTitle("Hello World") form_lbx = QBoxLayout(QBoxLayout.TopToBottom, parent=self) self.setLayout(form_lbx) te = QTextEdit() sb = StatusBar() form_lbx.addWidget(te) form_lbx.addWidget(sb) te.cursorPositionChanged.connect(lambda: sb.change_cursor_info(te.textCursor()))
def __init__(self): super(Widget_2, self).__init__() self.setTitle("Widget_2") self.box.addWidget(QTextEdit())
def add_new_tab(self): """ ??? ???? ?? ?? ?? """ self.tbw.addTab(QTextEdit(), "tab #%d" % (self.tbw.count() + 1))
def _create_projectview(self): """Spawn projectview.""" self.dock_projectview = QDockWidget() self.dock_projectview.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea) self.dock_projectview.setWidget(QTextEdit()) self.addDockWidget(Qt.LeftDockWidgetArea, self.dock_projectview)
def _create_templateview(self): """Spawn templateview.""" self.dock_templateview = QDockWidget() self.dock_templateview.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea | Qt.BottomDockWidgetArea) self.dock_templateview.setWidget(QTextEdit()) self.addDockWidget(Qt.BottomDockWidgetArea, self.dock_templateview)
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(529, 329) self.selInfoWidget = QtWidgets.QWidget(Form) self.selInfoWidget.setGeometry(QtCore.QRect(260, 10, 264, 222)) self.selInfoWidget.setObjectName("selInfoWidget") self.gridLayout = QtWidgets.QGridLayout(self.selInfoWidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setObjectName("gridLayout") self.selDescLabel = QtWidgets.QLabel(self.selInfoWidget) self.selDescLabel.setText("") self.selDescLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) self.selDescLabel.setWordWrap(True) self.selDescLabel.setObjectName("selDescLabel") self.gridLayout.addWidget(self.selDescLabel, 0, 0, 1, 1) self.selNameLabel = QtWidgets.QLabel(self.selInfoWidget) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.selNameLabel.setFont(font) self.selNameLabel.setText("") self.selNameLabel.setObjectName("selNameLabel") self.gridLayout.addWidget(self.selNameLabel, 0, 1, 1, 1) self.selectedTree = DataTreeWidget(self.selInfoWidget) self.selectedTree.setObjectName("selectedTree") self.selectedTree.headerItem().setText(0, "1") self.gridLayout.addWidget(self.selectedTree, 1, 0, 1, 2) self.hoverText = QtWidgets.QTextEdit(Form) self.hoverText.setGeometry(QtCore.QRect(0, 240, 521, 81)) self.hoverText.setObjectName("hoverText") self.view = FlowchartGraphicsView(Form) self.view.setGeometry(QtCore.QRect(0, 0, 256, 192)) self.view.setObjectName("view") self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def init_widget(self): """ ?? ??? ???? ??? """ self.setWindowTitle("Tab Widget") form_lbx = QBoxLayout(QBoxLayout.TopToBottom, parent=self) self.setLayout(form_lbx) tbw = QTabWidget() form_lbx.addWidget(tbw) # ? ?? tbw.addTab(QTextEdit(), "Tab #1")
def __init__(self, text): super().__init__() # finding windows_size self.setMinimumSize(QtCore.QSize(363, 300)) self.setWindowIcon(QIcon.fromTheme('persepolis', QIcon(':/persepolis.svg'))) self.setWindowTitle('Persepolis Download Manager') verticalLayout = QVBoxLayout(self) horizontalLayout = QHBoxLayout() horizontalLayout.addStretch(1) self.text_edit = QTextEdit(self) self.text_edit.setReadOnly(True) self.text_edit.insertPlainText(text) verticalLayout.addWidget(self.text_edit) self.label2 = QLabel(self) self.label2.setText('Reseting persepolis may solving problem.\nDo not panic!If you add your download links again,\npersepolis will resume your downloads\nPlease copy this error message and press "Report Issue" button\nand open a new issue in Github for it.\nWe answer you as soon as possible. \nreporting this issue help us to improve persepolis.\nThank you!') verticalLayout.addWidget(self.label2) self.report_pushButton = QPushButton(self) self.report_pushButton.setText("Report Issue") horizontalLayout.addWidget(self.report_pushButton) self.reset_persepolis_pushButton = QPushButton(self) self.reset_persepolis_pushButton.clicked.connect( self.resetPushButtonPressed) self.reset_persepolis_pushButton.setText('Reset Persepolis') horizontalLayout.addWidget(self.reset_persepolis_pushButton) self.close_pushButton = QPushButton(self) self.close_pushButton.setText('close') horizontalLayout.addWidget(self.close_pushButton) verticalLayout.addLayout(horizontalLayout) self.report_pushButton.clicked.connect(self.reportPushButtonPressed) self.close_pushButton.clicked.connect(self.closePushButtonPressed)