當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。