当前位置: 首页>>代码示例>>Python>>正文


Python QtWidgets.QTextBrowser方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QTextBrowser方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QTextBrowser方法的具体用法?Python QtWidgets.QTextBrowser怎么用?Python QtWidgets.QTextBrowser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets的用法示例。


在下文中一共展示了QtWidgets.QTextBrowser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTextBrowser [as 别名]
def __init__(self):
        """MainWindow constructor."""
        super().__init__()
        # Main UI code goes here
        main = qtw.QTextBrowser(minimumWidth=800, minimumHeight=600)
        self.setCentralWidget(main)

        # Must come before the HTML is inserted
        main.document().setDefaultStyleSheet(
            'body {color: #333; font-size: 14px;} '
            'h2 {background: #CCF; color: #443;} '
            'h1 {background: #001133; color: white;} '
        )

        # TextBrowser background is a widget style, not a document style
        main.setStyleSheet('background-color: #EEF;')
        with open('fight_fighter2.html', 'r') as fh:
            main.insertHtml(fh.read())

        main.setOpenExternalLinks(True)

        # End main UI code
        self.show() 
开发者ID:PacktPublishing,项目名称:Mastering-GUI-Programming-with-Python,代码行数:25,代码来源:qt_richtext_demo.py

示例2: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTextBrowser [as 别名]
def setupUi(self, DocDlg):
        DocDlg.setObjectName("DocDlg")
        DocDlg.resize(714, 454)
        self.verticalLayout = QtWidgets.QVBoxLayout(DocDlg)
        self.verticalLayout.setContentsMargins(6, 6, 6, 6)
        self.verticalLayout.setSpacing(6)
        self.verticalLayout.setObjectName("verticalLayout")
        self.textMain = QtWidgets.QTextBrowser(DocDlg)
        self.textMain.setStyleSheet("")
        self.textMain.setLineWrapMode(QtWidgets.QTextEdit.NoWrap)
        self.textMain.setOpenExternalLinks(True)
        self.textMain.setObjectName("textMain")
        self.verticalLayout.addWidget(self.textMain)
        self.buttonBox = QtWidgets.QDialogButtonBox(DocDlg)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close)
        self.buttonBox.setObjectName("buttonBox")
        self.verticalLayout.addWidget(self.buttonBox)

        self.retranslateUi(DocDlg)
        self.buttonBox.accepted.connect(DocDlg.accept)
        self.buttonBox.rejected.connect(DocDlg.reject)
        QtCore.QMetaObject.connectSlotsByName(DocDlg) 
开发者ID:Bertrand256,项目名称:dash-masternode-tool,代码行数:25,代码来源:ui_doc_dlg.py

示例3: mouseMoveEvent

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTextBrowser [as 别名]
def mouseMoveEvent(self, event):
        # Compare mouse positions
        # This allows to filter out scrolling
        # from a normal mouseEvent

        QtWidgets.QTextBrowser.mouseMoveEvent(self, event)
        if not self.mousePosition:
            self.mousePosition = event.pos()
            return

        current_position = event.pos()
        if current_position == self.mousePosition or self.parent.sideDock.isVisible():
            return
        else:
            self.mousePosition = event.pos()

            self.parent.navBar.show()
            if self.annotation_mode:
                self.viewport().setCursor(QtCore.Qt.IBeamCursor)
            else:
                self.viewport().setCursor(QtCore.Qt.ArrowCursor)
            self.parent.mouseHideTimer.start(2000) 
开发者ID:BasioMeusPuga,项目名称:Lector,代码行数:24,代码来源:contentwidgets.py

示例4: open_log

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTextBrowser [as 别名]
def open_log(self):
        info_log = QTextBrowser()
        info_log.setObjectName('TextFileEdit')
        info_log.setStyleSheet(self.window().styleSheet())
        info_log.setWindowTitle('Raw output')
        # Sets value to None when closed
        info_log.closeEvent = lambda _, inflog=info_log: setattr(self, '_open_window', None)

        # If a window already has been opened
        if self._open_window is not None:
            try:
                self._open_window.close()
            except:
                pass
        self._open_window = info_log

        info_log.setText('\n'.join(self.process.debug_log))
        info_log.show() 
开发者ID:Thomasedv,项目名称:Grabber,代码行数:20,代码来源:download_element.py

示例5: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTextBrowser [as 别名]
def __init__(self):
        super(TracebackWindow, self).__init__()
        self.framelist = []
        self.ret_add = 0x0
        self.setWindowTitle("Traceback")
        self.setLayout(QtWidgets.QVBoxLayout())
        self._layout = self.layout()

        # Creates the rich text viewer that displays the traceback
        self._textBrowser = QtWidgets.QTextBrowser()
        self._textBrowser.setOpenLinks(False)
        self._textBrowser.setFont(QFontDatabase.systemFont(QFontDatabase.FixedFont))
        self._layout.addWidget(self._textBrowser)

        # Creates the button that displays the return address
        self._ret = QtWidgets.QPushButton()
        self._ret.setFlat(True)
        self._layout.addWidget(self._ret)

        self.resize(self.width(), int(self.height() * 0.5))

        self.setObjectName('Traceback_Window') 
开发者ID:nccgroup,项目名称:binja_dynamics,代码行数:24,代码来源:__init__.py

示例6: resizeEvent

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTextBrowser [as 别名]
def resizeEvent(self, event=None):
        QtWidgets.QTextBrowser.resizeEvent(self, event)
        self.resizeTimer.start(100) 
开发者ID:BasioMeusPuga,项目名称:Lector,代码行数:5,代码来源:contentwidgets.py

示例7: mouseReleaseEvent

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTextBrowser [as 别名]
def mouseReleaseEvent(self, event):
        # This takes care of annotation placement
        # and addition to the list that holds all current annotations
        if not self.current_annotation:
            QtWidgets.QTextBrowser.mouseReleaseEvent(self, event)
            return

        self.place_annotation(self.current_annotation)
        self.toggle_annotation_mode() 
开发者ID:BasioMeusPuga,项目名称:Lector,代码行数:11,代码来源:contentwidgets.py

示例8: PopulateForm

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTextBrowser [as 别名]
def PopulateForm(self):
    self.layout = QtWidgets.QVBoxLayout()
    self.browser = QtWidgets.QTextBrowser()
    self.browser.setLineWrapMode(QtWidgets.QTextEdit.NoWrap)
    self.browser.setHtml(self.text)
    self.browser.setReadOnly(True)
    self.browser.setFontWeight(12)
    self.layout.addWidget(self.browser)
    self.parent.setLayout(self.layout) 
开发者ID:joxeankoret,项目名称:maltindex,代码行数:11,代码来源:diaphora_ida.py

示例9: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTextBrowser [as 别名]
def setupUi(self, CmdConsoleDlg):
        CmdConsoleDlg.setObjectName("CmdConsoleDlg")
        CmdConsoleDlg.resize(468, 334)
        self.verticalLayout = QtWidgets.QVBoxLayout(CmdConsoleDlg)
        self.verticalLayout.setObjectName("verticalLayout")
        self.edtCmdLog = QtWidgets.QTextBrowser(CmdConsoleDlg)
        font = QtGui.QFont()
        font.setFamily("Courier New")
        font.setPointSize(12)
        font.setKerning(False)
        self.edtCmdLog.setFont(font)
        self.edtCmdLog.setLineWrapMode(QtWidgets.QTextEdit.WidgetWidth)
        self.edtCmdLog.setObjectName("edtCmdLog")
        self.verticalLayout.addWidget(self.edtCmdLog)
        self.label = QtWidgets.QLabel(CmdConsoleDlg)
        self.label.setObjectName("label")
        self.verticalLayout.addWidget(self.label)
        self.edtCommand = QtWidgets.QLineEdit(CmdConsoleDlg)
        self.edtCommand.setClearButtonEnabled(True)
        self.edtCommand.setObjectName("edtCommand")
        self.verticalLayout.addWidget(self.edtCommand)
        self.buttonBox = QtWidgets.QDialogButtonBox(CmdConsoleDlg)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close)
        self.buttonBox.setObjectName("buttonBox")
        self.verticalLayout.addWidget(self.buttonBox)

        self.retranslateUi(CmdConsoleDlg)
        self.buttonBox.accepted.connect(CmdConsoleDlg.accept)
        self.buttonBox.rejected.connect(CmdConsoleDlg.reject)
        QtCore.QMetaObject.connectSlotsByName(CmdConsoleDlg) 
开发者ID:Bertrand256,项目名称:dash-masternode-tool,代码行数:33,代码来源:ui_cmd_console_dlg.py

示例10: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTextBrowser [as 别名]
def __init__(self, text, details, parent=None):
        super().__init__(parent=parent)
        self.setMinimumHeight(300)

        self.layout = QtWidgets.QVBoxLayout(self)
        self.setLayout(self.layout)

        label = QtWidgets.QLabel(text, self)
        self.layout.addWidget(label)

        browser = QtWidgets.QTextBrowser(self)
        browser.setText(details)
        self.layout.addWidget(browser) 
开发者ID:ScriptSmith,项目名称:reaper,代码行数:15,代码来源:windows.py

示例11: get_QTextBrowser

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTextBrowser [as 别名]
def get_QTextBrowser():
    """QTextBrowser getter."""

    try:
        import PySide.QtGui as QtGui
        return QtGui.QTextBrowser
    except ImportError:
        import PyQt5.QtWidgets as QtWidgets
        return QtWidgets.QTextBrowser 
开发者ID:AirbusCyber,项目名称:grap,代码行数:11,代码来源:QtShim.py

示例12: initUI

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTextBrowser [as 别名]
def initUI(self):
    self.statsBox = QtWidgets.QTextBrowser(self)
    #self.updateBtn = QtGui.QPushButton("Update", self)
    #self.updateBtn.clicked.connect(self.calcStats)

    layout = QtWidgets.QVBoxLayout()
    layout.addWidget(self.statsBox)
    #layout.addWidget(self.updateBtn)
    self.setLayout(layout) 
开发者ID:cwebster2,项目名称:pyMeteo,代码行数:11,代码来源:StatWidget.py

示例13: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTextBrowser [as 别名]
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1279, 677)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.tableWidget = QtWidgets.QTableWidget(self.centralwidget)
        self.tableWidget.setGeometry(QtCore.QRect(150, 80, 441, 331))
        self.tableWidget.setObjectName("tableWidget")
        self.tableWidget.setColumnCount(0)
        self.tableWidget.setRowCount(0)
        self.pushButton = QtWidgets.QPushButton(self.centralwidget) # 生成相对应的对象
        self.pushButton.setGeometry(QtCore.QRect(310, 510, 171, 61))# 确定该对象的位置以及大小
        self.pushButton.setObjectName("pushButton")                 # 设置名字,加载对象
        self.checkBox = QtWidgets.QCheckBox(self.centralwidget)
        self.checkBox.setGeometry(QtCore.QRect(870, 530, 91, 19))
        self.checkBox.setObjectName("checkBox")
        self.textBrowser = QtWidgets.QTextBrowser(self.centralwidget)
        self.textBrowser.setGeometry(QtCore.QRect(750, 90, 421, 321))
        self.textBrowser.setObjectName("textBrowser")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1279, 23))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow) 
开发者ID:Yeah-Kun,项目名称:python,代码行数:32,代码来源:select.py

示例14: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTextBrowser [as 别名]
def __init__(self, *args, **kwargs):
        super(Window, self).__init__(*args, **kwargs)
        layout = QVBoxLayout(self)
        self.button1 = QPushButton('已连接', self, clicked=self.doTest)
        self.button2 = QPushButton('未连接', self)
        self.retView = QTextBrowser(self)
        layout.addWidget(self.button1)
        layout.addWidget(self.button2)
        layout.addWidget(self.retView) 
开发者ID:PyQt5,项目名称:PyQt,代码行数:11,代码来源:IsSignalConnected.py

示例15: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QTextBrowser [as 别名]
def setupUi(self, PasteDialog):
        PasteDialog.setObjectName("PasteDialog")
        PasteDialog.resize(400, 300)
        self.gridLayout = QtWidgets.QGridLayout(PasteDialog)
        self.gridLayout.setObjectName("gridLayout")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.textBrowser = QtWidgets.QTextBrowser(PasteDialog)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.textBrowser.sizePolicy().hasHeightForWidth())
        self.textBrowser.setSizePolicy(sizePolicy)
        self.textBrowser.setAcceptRichText(False)
        self.textBrowser.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByKeyboard|QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextBrowserInteraction|QtCore.Qt.TextEditable|QtCore.Qt.TextEditorInteraction|QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse)
        self.textBrowser.setOpenLinks(False)
        self.textBrowser.setObjectName("textBrowser")
        self.verticalLayout.addWidget(self.textBrowser)
        spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem1)
        self.buttonImport = QtWidgets.QPushButton(PasteDialog)
        self.buttonImport.setObjectName("buttonImport")
        self.horizontalLayout.addWidget(self.buttonImport)
        self.buttonCancel = QtWidgets.QPushButton(PasteDialog)
        self.buttonCancel.setObjectName("buttonCancel")
        self.horizontalLayout.addWidget(self.buttonCancel)
        self.buttonOk = QtWidgets.QPushButton(PasteDialog)
        self.buttonOk.setObjectName("buttonOk")
        self.horizontalLayout.addWidget(self.buttonOk)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)

        self.retranslateUi(PasteDialog)
        QtCore.QMetaObject.connectSlotsByName(PasteDialog) 
开发者ID:Blockstream,项目名称:liquid-swap,代码行数:40,代码来源:dialogpaste.py


注:本文中的PyQt5.QtWidgets.QTextBrowser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。