当前位置: 首页>>代码示例>>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;未经允许,请勿转载。