當前位置: 首頁>>代碼示例>>Python>>正文


Python QtWidgets.QTextEdit方法代碼示例

本文整理匯總了Python中PyQt5.QtWidgets.QTextEdit方法的典型用法代碼示例。如果您正苦於以下問題:Python QtWidgets.QTextEdit方法的具體用法?Python QtWidgets.QTextEdit怎麽用?Python QtWidgets.QTextEdit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt5.QtWidgets的用法示例。


在下文中一共展示了QtWidgets.QTextEdit方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_highlighted

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTextEdit [as 別名]
def test_highlighted(qtbot):
    """Make sure highlighting works.

    Note that with Qt 5.11.3 and > 5.12.1 we need to call setPlainText *after*
    creating the highlighter for highlighting to work. Ideally, we'd test
    whether CompletionItemDelegate._get_textdoc() works properly, but testing
    that is kind of hard, so we just test it in isolation here.
    """
    doc = QTextDocument()
    completiondelegate._Highlighter(doc, 'Hello', Qt.red)
    doc.setPlainText('Hello World')

    # Needed so the highlighting actually works.
    edit = QTextEdit()
    qtbot.addWidget(edit)
    edit.setDocument(doc)

    colors = [f.foreground().color() for f in doc.allFormats()]
    assert QColor('red') in colors 
開發者ID:qutebrowser,項目名稱:qutebrowser,代碼行數:21,代碼來源:test_completiondelegate.py

示例2: __init__

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTextEdit [as 別名]
def __init__(self, parent=None):
        super(TextInput, self).__init__(parent)

        self.setWindowFlags(Qt.Dialog | Qt.FramelessWindowHint)

        self.mainLayout = QVBoxLayout()
        self.textArea = QTextEdit(self)

        self.buttonArea = QWidget(self)
        self.buttonLayout = QHBoxLayout()
        self.cancelButton = QPushButton('Cancel', self)
        self.okButton = QPushButton('Ok', self)
        self.buttonLayout.addWidget(self.cancelButton)
        self.buttonLayout.addWidget(self.okButton)
        self.buttonArea.setLayout(self.buttonLayout)

        self.mainLayout.addWidget(self.textArea)
        self.mainLayout.addWidget(self.buttonArea)
        self.setLayout(self.mainLayout)

        self.textArea.textChanged.connect(self.textChanged_)
        self.okButton.clicked.connect(self.okButtonClicked)
        self.cancelButton.clicked.connect(self.cancelPressed) 
開發者ID:SeptemberHX,項目名稱:screenshot,代碼行數:25,代碼來源:textinput.py

示例3: __init__

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTextEdit [as 別名]
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() 
開發者ID:tjguk,項目名稱:networkzero,代碼行數:24,代碼來源:chatter.py

示例4: _logInfoWidget

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTextEdit [as 別名]
def _logInfoWidget(self):
        group = QGroupBox()
        group.setTitle(catalog.i18nc("@title:groupbox", "Logs"))
        layout = QVBoxLayout()

        text_area = QTextEdit()
        tmp_file_fd, tmp_file_path = tempfile.mkstemp(prefix = "cura-crash", text = True)
        os.close(tmp_file_fd)
        with open(tmp_file_path, "w", encoding = "utf-8") as f:
            faulthandler.dump_traceback(f, all_threads=True)
        with open(tmp_file_path, "r", encoding = "utf-8") as f:
            logdata = f.read()

        text_area.setText(logdata)
        text_area.setReadOnly(True)

        layout.addWidget(text_area)
        group.setLayout(layout)

        self.data["log"] = logdata

        return group 
開發者ID:Ultimaker,項目名稱:Cura,代碼行數:24,代碼來源:CrashHandler.py

示例5: initUI

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTextEdit [as 別名]
def initUI(self):

        self.text = QtWidgets.QTextEdit(self)

        # Set the tab stop width to around 33 pixels which is
        # more or less 8 spaces
        self.text.setTabStopWidth(33)

        self.initToolbar()
        self.initFormatbar()
        self.initMenubar()

        self.setCentralWidget(self.text)

        # Initialize a statusbar for the window
        self.statusbar = self.statusBar()

        # If the cursor position changes, call the function that displays
        # the line and column number
        self.text.cursorPositionChanged.connect(self.cursorPosition)

        self.setGeometry(100,100,1030,800)
        self.setWindowTitle("Writer")
        self.setWindowIcon(QtGui.QIcon("icons/icon.png")) 
開發者ID:goldsborough,項目名稱:Writer-Tutorial,代碼行數:26,代碼來源:part-3.py

示例6: configsettings

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTextEdit [as 別名]
def configsettings(self):
        self.line501 = QtWidgets.QTextEdit()
        self.gl7.addWidget(self.line501, 0, 0, 1, 3)
        msg = '<html>Use this config file, otherwise global config file will be used</html>'
        self.checkbox = QtWidgets.QCheckBox("Use This Config File")
        self.checkbox.setMinimumHeight(30)
        self.checkbox.stateChanged.connect(self.use_config_file)
        self.checkbox.setToolTip(msg)
        self.gl7.addWidget(self.checkbox, 1, 0, 1, 1)
        if ui.use_custom_config_file:
            self.checkbox.setChecked(True)
        mpvlist = self.basic_params(player='mpv')
        mpvstr = '\n'.join(mpvlist)
        self.line501.setText(mpvstr) 
        
        self.btn_default_settings = QPushButtonExtra('Default Settings')
        self.gl7.addWidget(self.btn_default_settings, 1, 1, 1, 1)
        self.btn_default_settings.clicked_connect(self.get_default_config_settings)
        self.btn_default_settings.setMinimumHeight(30)
        
        self.btn_confirm = QPushButtonExtra('Save Changes')
        self.gl7.addWidget(self.btn_confirm, 1, 2, 1, 1)
        self.btn_confirm.clicked_connect(self.save_config_settings)
        self.btn_confirm.setMinimumHeight(30) 
開發者ID:kanishka-linux,項目名稱:kawaii-player,代碼行數:26,代碼來源:settings_widget.py

示例7: apply_tab_shortcuts

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTextEdit [as 別名]
def apply_tab_shortcuts(self):
        self.line601 = QtWidgets.QTextEdit()
        self.gl8.addWidget(self.line601, 0, 0, 1, 2)
        
        if os.path.isfile(ui.custom_key_file) and os.stat(ui.custom_key_file).st_size:
            lines = open_files(ui.mpv_input_conf, True)
            lines = [i.strip() for i in lines if i.strip()]
            text = self.get_default_shortcuts_in_text(ui.tab_5.mpv_default, lines)
            self.line601.setText(text) 
        else:
            self.get_default_shortcuts_settings()
        
        self.btn_shortcut_default = QPushButtonExtra('Default Settings')
        self.gl8.addWidget(self.btn_shortcut_default, 1, 0, 1, 1)
        self.btn_shortcut_default.clicked_connect(self.get_default_shortcuts_settings)
        self.btn_shortcut_default.setMinimumHeight(30)
        
        self.btn_shortcut_confirm = QPushButtonExtra('Save Changes')
        self.gl8.addWidget(self.btn_shortcut_confirm, 1, 1, 1, 1)
        self.btn_shortcut_confirm.clicked_connect(self.save_shortcut_settings)
        self.btn_shortcut_confirm.setMinimumHeight(30) 
開發者ID:kanishka-linux,項目名稱:kawaii-player,代碼行數:23,代碼來源:settings_widget.py

示例8: __init__

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTextEdit [as 別名]
def __init__(self,parent=None):
        super(noteCreationWidgetLayout,self).__init__()
        
        #Elements Present on Note Creation GUI
        self.title = QLabel('Title')
        self.titleEdit = QLineEdit()
        self.summary = QLabel('Summary')
        self.summaryEdit = QTextEdit()
        self.saveButton = QPushButton("Save")
        self.saveButton.clicked.connect(self.createNewFile)
        self.notesList = QPushButton("Notes")
        self.notesList.clicked.connect(self.createNotesList)

        #Main Layout
        self.noteLayout = QGridLayout()

        #Position of Widgets/Elements on Main Layout
        self.noteLayout.addWidget(self.title, 1, 0)
        self.noteLayout.addWidget(self.titleEdit, 1, 1)

        self.noteLayout.addWidget(self.summary, 2, 0)
        self.noteLayout.addWidget(self.summaryEdit, 2, 1, 10, 1)
        
        self.noteLayout.addWidget(self.saveButton,12,0)
        self.noteLayout.addWidget(self.notesList,13,0) 
開發者ID:ugroot,項目名稱:GROOT,代碼行數:27,代碼來源:notesWindow.py

示例9: _create_gui

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTextEdit [as 別名]
def _create_gui(self):
        self._create_table()   
      
        self.te_tcache_chain = QtWidgets.QTextEdit()
        self.te_tcache_chain.setFixedHeight(100)
        self.te_tcache_chain.setReadOnly(True)
        
        vbox_tcache_chain = QtWidgets.QVBoxLayout()
        vbox_tcache_chain.addWidget(QtWidgets.QLabel('Chain info'))
        vbox_tcache_chain.addWidget(self.te_tcache_chain)

        vbox_tcache = QtWidgets.QVBoxLayout()
        vbox_tcache.addWidget(QtWidgets.QLabel('Tcache entries'))
        vbox_tcache.addWidget(self.tbl_tcache)
        vbox_tcache.addLayout(vbox_tcache_chain)
        vbox_tcache.addStretch(1)

        self.setLayout(vbox_tcache) 
開發者ID:danigargu,項目名稱:heap-viewer,代碼行數:20,代碼來源:bins.py

示例10: _create_gui

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTextEdit [as 別名]
def _create_gui(self):
        self.t_unlink_addr = QtWidgets.QLineEdit()
        self.t_unlink_addr.setFixedWidth(150)
        self.t_unlink_info = QtWidgets.QTextEdit()
        self.t_unlink_info.setFixedHeight(400)
        self.t_unlink_info.setReadOnly(True)

        self.btn_check_unlink = QtWidgets.QPushButton("Check")
        self.btn_check_unlink.clicked.connect(self.check_unlink_on_click)

        hbox_unlink = QtWidgets.QHBoxLayout()
        hbox_unlink.addWidget(QtWidgets.QLabel('Chunk ptr unlink'))
        hbox_unlink.addWidget(self.t_unlink_addr)
        hbox_unlink.addWidget(self.btn_check_unlink)
        hbox_unlink.addStretch(1)

        vbox_unlink = QtWidgets.QVBoxLayout()
        vbox_unlink.addLayout(hbox_unlink)
        vbox_unlink.addWidget(self.t_unlink_info)
        vbox_unlink.addStretch(1)
        vbox_unlink.setContentsMargins(0, 0, 0, 0)
        self.setLayout(vbox_unlink) 
開發者ID:danigargu,項目名稱:heap-viewer,代碼行數:24,代碼來源:magic.py

示例11: __init__

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTextEdit [as 別名]
def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.setLayout(QVBoxLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)

        self.__cue = None

        # cue name
        self.cueName = QLineEdit(self)
        self.cueName.setFocusPolicy(Qt.NoFocus)
        self.cueName.setReadOnly(True)
        self.layout().addWidget(self.cueName)

        # cue description
        self.cueDescription = QTextEdit(self)
        self.cueDescription.setObjectName('InfoPanelDescription')
        self.cueDescription.setFocusPolicy(Qt.NoFocus)
        self.cueDescription.setReadOnly(True)
        self.layout().addWidget(self.cueDescription)

        self.retranslateUi() 
開發者ID:FrancescoCeruti,項目名稱:linux-show-player,代碼行數:23,代碼來源:info_panel.py

示例12: initUI

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTextEdit [as 別名]
def initUI(self):
        self.macro_command_textEdit = QtWidgets.QTextEdit()
        self.macro_command_textEdit.setPlainText("#!MC 1410")

        addExecuteMacroCommand_Button = QtWidgets.QPushButton("Execute")
        addExecuteMacroCommand_Button.clicked.connect(self.execute_macro_command_CB)

        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(self.macro_command_textEdit)
        vbox.addWidget(addExecuteMacroCommand_Button)

        self.setLayout(vbox)

        self.setGeometry(300, 300, 800, 600)
        self.setWindowTitle('Macro Command Runner')
        self.show() 
開發者ID:Tecplot,項目名稱:handyscripts,代碼行數:18,代碼來源:pyqt5_execute_macro_command.py

示例13: initUI

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTextEdit [as 別名]
def initUI(self):               

        textEdit = QTextEdit()
        self.setCentralWidget(textEdit)

        exitAct = QAction(QIcon('exit24.png'), 'Exit', self)
        exitAct.setShortcut('Ctrl+Q')
        exitAct.setStatusTip('Exit application')
        exitAct.triggered.connect(self.close)

        self.statusBar()

        menubar = self.menuBar()
        fileMenu = menubar.addMenu('&File')
        fileMenu.addAction(exitAct)

        toolbar = self.addToolBar('Exit')
        toolbar.addAction(exitAct)

        self.setGeometry(300, 300, 350, 250)
        self.setWindowTitle('Main window')    
        self.show() 
開發者ID:Yeah-Kun,項目名稱:python,代碼行數:24,代碼來源:Putting_it_together.py

示例14: setupUi

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTextEdit [as 別名]
def setupUi(self, AnalysisProgress):
        AnalysisProgress.setObjectName("AnalysisProgress")
        AnalysisProgress.resize(594, 465)
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(AnalysisProgress)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.progressBar = QtWidgets.QProgressBar(AnalysisProgress)
        self.progressBar.setProperty("value", 0)
        self.progressBar.setInvertedAppearance(False)
        self.progressBar.setObjectName("progressBar")
        self.verticalLayout.addWidget(self.progressBar)
        self.textEdit = QtWidgets.QTextEdit(AnalysisProgress)
        self.textEdit.setReadOnly(True)
        self.textEdit.setObjectName("textEdit")
        self.verticalLayout.addWidget(self.textEdit)
        self.verticalLayout_2.addLayout(self.verticalLayout)

        self.retranslateUi(AnalysisProgress)
        QtCore.QMetaObject.connectSlotsByName(AnalysisProgress) 
開發者ID:ver228,項目名稱:tierpsy-tracker,代碼行數:22,代碼來源:AnalysisProgress_ui.py

示例15: initUI

# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QTextEdit [as 別名]
def initUI(self):

        self.confirm_button = QPushButton()

        self.headline = QFont("Arial", 10, QFont.Bold)

        self.elementInfo = QLabel()
        self.elementInfo.setFont(self.headline)

        self.exceptionMessage = QTextEdit()
        self.exceptionMessage.setReadOnly(True)

        self.setMinimumSize(400, 300)
        self.setWindowFlags(Qt.Window)

        self.exceptWindowLayout = QVBoxLayout()
        self.exceptWindowLayout.addWidget(self.elementInfo)
        self.exceptWindowLayout.addWidget(self.exceptionMessage)
        self.exceptWindowLayout.addStretch(1)
        self.exceptWindowLayout.addWidget(self.confirm_button)

        self.confirm_button.clicked.connect(self.close)

        self.setLayout(self.exceptWindowLayout) 
開發者ID:hANSIc99,項目名稱:Pythonic,代碼行數:26,代碼來源:exceptwindow.py


注:本文中的PyQt5.QtWidgets.QTextEdit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。