本文整理匯總了Python中PyQt4.QtGui.QTextBrowser方法的典型用法代碼示例。如果您正苦於以下問題:Python QtGui.QTextBrowser方法的具體用法?Python QtGui.QTextBrowser怎麽用?Python QtGui.QTextBrowser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt4.QtGui
的用法示例。
在下文中一共展示了QtGui.QTextBrowser方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: manual
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QTextBrowser [as 別名]
def manual(self):
data=QtCore.QFile("ar/help_body.html");
if (data.open(QtCore.QFile.ReadOnly)):
textstream=QtCore.QTextStream(data);
textstream.setCodec("UTF-8");
text=textstream.readAll();
else:
text=u"لا يمكن فتح ملف المساعدة"
Dialog=QtGui.QDialog(self.centralwidget)
Dialog.setObjectName("Dialog")
Dialog.resize(480, 480)
Dialog.setWindowTitle(u'دليل الاستعمال')
gridLayout = QtGui.QGridLayout(Dialog)
gridLayout.setObjectName("gridLayout")
textBrowser = QtGui.QTextBrowser(Dialog)
textBrowser.setObjectName("textBrowser")
gridLayout.addWidget(textBrowser, 0, 0, 1, 1)
buttonBox = QtGui.QDialogButtonBox(Dialog)
buttonBox.setOrientation(QtCore.Qt.Horizontal)
buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok)
buttonBox.setObjectName("buttonBox")
gridLayout.addWidget(buttonBox, 1, 0, 1, 1)
QtCore.QObject.connect(buttonBox, QtCore.SIGNAL("accepted()"), Dialog.accept)
QtCore.QMetaObject.connectSlotsByName(Dialog)
text2=unicode(text)
textBrowser.setText(text2)
RightToLeft=1;
Dialog.setLayoutDirection(RightToLeft);
Dialog.show();
示例2: setupUi
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QTextBrowser [as 別名]
def setupUi(self, howToWidget):
howToWidget.setObjectName(_fromUtf8("howToWidget"))
howToWidget.resize(800, 600)
howToWidget.setStyleSheet(_fromUtf8(""))
self.logoImg = LogoImage(howToWidget)
self.logoImg.setGeometry(QtCore.QRect(698, 10, 141, 101))
self.logoImg.setObjectName(_fromUtf8("logoImg"))
self.howToUseLabel = QtGui.QLabel(howToWidget)
self.howToUseLabel.setGeometry(QtCore.QRect(60, 50, 271, 31))
font = QtGui.QFont()
font.setPointSize(16)
font.setBold(True)
font.setWeight(75)
self.howToUseLabel.setFont(font)
self.howToUseLabel.setObjectName(_fromUtf8("howToUseLabel"))
self.setupPushButton = QtGui.QPushButton(howToWidget)
self.setupPushButton.setGeometry(QtCore.QRect(714, 130, 71, 27))
self.setupPushButton.setStyleSheet(_fromUtf8("background-color:rgb(85, 170, 255);\n"
"color:rgb(255,255,255)"))
self.setupPushButton.setObjectName(_fromUtf8("setupPushButton"))
self.helpPushButton = QtGui.QPushButton(howToWidget)
self.helpPushButton.setGeometry(QtCore.QRect(713, 163, 71, 27))
self.helpPushButton.setStyleSheet(_fromUtf8("background-color:rgb(85, 170, 255);\n"
"color:rgb(255,255,255)"))
self.helpPushButton.setObjectName(_fromUtf8("helpPushButton"))
self.howToUseTextBrowser = QtGui.QTextBrowser(howToWidget)
self.howToUseTextBrowser.setGeometry(QtCore.QRect(60, 110, 561, 431))
self.howToUseTextBrowser.setObjectName(_fromUtf8("howToUseTextBrowser"))
self.retranslateUi(howToWidget)
QtCore.QMetaObject.connectSlotsByName(howToWidget)
示例3: __init__
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QTextBrowser [as 別名]
def __init__(self):
QtGui.QWidget.__init__(self)
self.vlayout = QtGui.QVBoxLayout()
self.browser = QtGui.QTextBrowser()
self.browser.setSource(QtCore.QUrl(
"library/browser/welcome.html")
)
self.browser.setOpenExternalLinks(True)
self.browser.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.vlayout.addWidget(self.browser)
self.setLayout(self.vlayout)
self.show()
示例4: setupUi
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QTextBrowser [as 別名]
def setupUi(self, completeWidget):
completeWidget.setObjectName(_fromUtf8("completeWidget"))
completeWidget.resize(800, 600)
completeWidget.setStyleSheet(_fromUtf8(""))
self.logoImg = LogoImage(completeWidget)
self.logoImg.setGeometry(QtCore.QRect(698, 10, 141, 101))
self.logoImg.setObjectName(_fromUtf8("logoImg"))
self.installedLabel = QtGui.QLabel(completeWidget)
self.installedLabel.setGeometry(QtCore.QRect(60, 50, 561, 31))
font = QtGui.QFont()
font.setPointSize(16)
font.setBold(True)
font.setWeight(75)
self.installedLabel.setFont(font)
self.installedLabel.setObjectName(_fromUtf8("installedLabel"))
self.setupPushButton = QtGui.QPushButton(completeWidget)
self.setupPushButton.setGeometry(QtCore.QRect(714, 130, 71, 27))
self.setupPushButton.setStyleSheet(_fromUtf8("background-color:rgb(85, 170, 255);\n"
"color:rgb(255,255,255)"))
self.setupPushButton.setObjectName(_fromUtf8("setupPushButton"))
self.helpPushButton = QtGui.QPushButton(completeWidget)
self.helpPushButton.setGeometry(QtCore.QRect(713, 163, 71, 27))
self.helpPushButton.setStyleSheet(_fromUtf8("background-color:rgb(85, 170, 255);\n"
"color:rgb(255,255,255)"))
self.helpPushButton.setObjectName(_fromUtf8("helpPushButton"))
self.installedInfoTextBrowser = QtGui.QTextBrowser(completeWidget)
self.installedInfoTextBrowser.setGeometry(QtCore.QRect(60, 110, 561, 181))
self.installedInfoTextBrowser.setObjectName(_fromUtf8("installedInfoTextBrowser"))
self.visitHiddenServicePushButton = QtGui.QPushButton(completeWidget)
self.visitHiddenServicePushButton.setGeometry(QtCore.QRect(396, 330, 225, 50))
font = QtGui.QFont()
font.setPointSize(12)
self.visitHiddenServicePushButton.setFont(font)
self.visitHiddenServicePushButton.setStyleSheet(_fromUtf8("background-color:rgb(85, 170, 255);\n"
"color:rgb(255,255,255)"))
self.visitHiddenServicePushButton.setObjectName(_fromUtf8("visitHiddenServicePushButton"))
self.howToGuidePushButton = QtGui.QPushButton(completeWidget)
self.howToGuidePushButton.setGeometry(QtCore.QRect(59, 330, 225, 50))
font = QtGui.QFont()
font.setPointSize(12)
self.howToGuidePushButton.setFont(font)
self.howToGuidePushButton.setStyleSheet(_fromUtf8("background-color:rgb(85, 170, 255);\n"
"color:rgb(255,255,255)"))
self.howToGuidePushButton.setObjectName(_fromUtf8("howToGuidePushButton"))
self.retranslateUi(completeWidget)
QtCore.QMetaObject.connectSlotsByName(completeWidget)
示例5: setupUi
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QTextBrowser [as 別名]
def setupUi(self, installWidget):
installWidget.setObjectName(_fromUtf8("installWidget"))
installWidget.resize(800, 600)
installWidget.setStyleSheet(_fromUtf8(""))
self.logoImg = LogoImage(installWidget)
self.logoImg.setGeometry(QtCore.QRect(698, 10, 141, 101))
self.logoImg.setObjectName(_fromUtf8("logoImg"))
self.installLabel = QtGui.QLabel(installWidget)
self.installLabel.setGeometry(QtCore.QRect(60, 50, 561, 31))
font = QtGui.QFont()
font.setPointSize(16)
font.setBold(True)
font.setWeight(75)
self.installLabel.setFont(font)
self.installLabel.setObjectName(_fromUtf8("installLabel"))
self.howPushButton = QtGui.QPushButton(installWidget)
self.howPushButton.setGeometry(QtCore.QRect(714, 130, 71, 27))
self.howPushButton.setStyleSheet(_fromUtf8("background-color:rgb(85, 170, 255);\n"
"color:rgb(255,255,255)"))
self.howPushButton.setObjectName(_fromUtf8("howPushButton"))
self.helpPushButton = QtGui.QPushButton(installWidget)
self.helpPushButton.setGeometry(QtCore.QRect(713, 163, 71, 27))
self.helpPushButton.setStyleSheet(_fromUtf8("background-color:rgb(85, 170, 255);\n"
"color:rgb(255,255,255)"))
self.helpPushButton.setObjectName(_fromUtf8("helpPushButton"))
self.installInfoTextBrowser = QtGui.QTextBrowser(installWidget)
self.installInfoTextBrowser.setGeometry(QtCore.QRect(60, 110, 561, 271))
self.installInfoTextBrowser.setObjectName(_fromUtf8("installInfoTextBrowser"))
self.continuePushButton = QtGui.QPushButton(installWidget)
self.continuePushButton.setGeometry(QtCore.QRect(460, 400, 120, 50))
font = QtGui.QFont()
font.setPointSize(12)
self.continuePushButton.setFont(font)
self.continuePushButton.setStyleSheet(_fromUtf8("background-color:rgb(85, 170, 255);\n"
"color:rgb(255,255,255)"))
self.continuePushButton.setObjectName(_fromUtf8("continuePushButton"))
self.goBackPushButton = QtGui.QPushButton(installWidget)
self.goBackPushButton.setGeometry(QtCore.QRect(100, 400, 120, 50))
font = QtGui.QFont()
font.setPointSize(12)
self.goBackPushButton.setFont(font)
self.goBackPushButton.setStyleSheet(_fromUtf8("background-color:rgb(85, 170, 255);\n"
"color:rgb(255,255,255)"))
self.goBackPushButton.setObjectName(_fromUtf8("goBackPushButton"))
self.retranslateUi(installWidget)
QtCore.QMetaObject.connectSlotsByName(installWidget)
示例6: createWidget
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QTextBrowser [as 別名]
def createWidget(self, style, listWidget, chat_msg,uin,flag=0,g_sender=None):
self.listWidgetItem = QtGui.QListWidgetItem(listWidget)
self.listWidgetItem.setSizeHint(QtCore.QSize(0, 50))
self.widget = QtGui.QWidget()
self.graphicsView = QtGui.QGraphicsView(self.widget)
self.label = QtGui.QTextBrowser(self.widget)
self.label.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
orient=''
if flag==0:
ruin=uin
else:
ruin=g_sender
print 'img senderuin:',ruin
if style == 0:
self.widget.setGeometry(QtCore.QRect(0, 10, 455, 50))
self.graphicsView.setGeometry(QtCore.QRect(5, 5, 60, 60))
self.graphicsView.setScene(self.createImg(ruin,flag,g_sender))
self.graphicsView.resize(50,50)
self.label.setGeometry(QtCore.QRect(50, 5, 390, 50))
orient='left'
elif style == 1:
self.widget.setGeometry(QtCore.QRect(0, 10, 455, 50))
self.graphicsView.setGeometry(QtCore.QRect(392, 5, 60, 60))
self.graphicsView.setScene(self.createImg(ruin,flag,g_sender))
self.graphicsView.resize(50,50)
self.label.setGeometry(QtCore.QRect(10, 5, 390, 50))
orient='right'
# msg edit
if flag==1:
nick=self.groupInfo[uin][g_sender]['nick']
if flag==2:
nick=self.discussInfo[uin][g_sender]['nick']
if flag==1 or flag==2:
chat_msg=u'<p><b>'+nick+'</b></p><p>'+chat_msg+'</p>'
content = u'''
<html><body><p align="'''+orient+'''"> ''' + chat_msg + '''</p></body></html>
'''
doc = QtGui.QTextDocument(self.label)
doc.setHtml(content)
self.label.setDocument(doc)
# resize
size = max(self.label.document().size().height() + 5, 50)
self.listWidgetItem.setSizeHint(QtCore.QSize(445, size))
self.widget.resize(455, size)
self.label.resize(380, size)
return self.listWidgetItem, self.widget
示例7: setupUi
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QTextBrowser [as 別名]
def setupUi(self, InitializeDialog):
InitializeDialog.setObjectName(_fromUtf8("InitializeDialog"))
InitializeDialog.resize(400, 378)
self.verticalLayout = QtGui.QVBoxLayout(InitializeDialog)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.textBrowser = QtGui.QTextBrowser(InitializeDialog)
self.textBrowser.setFocusPolicy(QtCore.Qt.NoFocus)
self.textBrowser.setObjectName(_fromUtf8("textBrowser"))
self.verticalLayout.addWidget(self.textBrowser)
self.label_3 = QtGui.QLabel(InitializeDialog)
self.label_3.setObjectName(_fromUtf8("label_3"))
self.verticalLayout.addWidget(self.label_3)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.pwFileEdit = QtGui.QLineEdit(InitializeDialog)
self.pwFileEdit.setObjectName(_fromUtf8("pwFileEdit"))
self.horizontalLayout.addWidget(self.pwFileEdit)
self.pwFileButton = QtGui.QPushButton(InitializeDialog)
self.pwFileButton.setObjectName(_fromUtf8("pwFileButton"))
self.horizontalLayout.addWidget(self.pwFileButton)
self.verticalLayout.addLayout(self.horizontalLayout)
self.label = QtGui.QLabel(InitializeDialog)
self.label.setObjectName(_fromUtf8("label"))
self.verticalLayout.addWidget(self.label)
self.masterEdit1 = QtGui.QLineEdit(InitializeDialog)
self.masterEdit1.setEchoMode(QtGui.QLineEdit.Password)
self.masterEdit1.setObjectName(_fromUtf8("masterEdit1"))
self.verticalLayout.addWidget(self.masterEdit1)
self.label_2 = QtGui.QLabel(InitializeDialog)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.verticalLayout.addWidget(self.label_2)
self.masterEdit2 = QtGui.QLineEdit(InitializeDialog)
self.masterEdit2.setEchoMode(QtGui.QLineEdit.Password)
self.masterEdit2.setObjectName(_fromUtf8("masterEdit2"))
self.verticalLayout.addWidget(self.masterEdit2)
self.buttonBox = QtGui.QDialogButtonBox(InitializeDialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.verticalLayout.addWidget(self.buttonBox)
self.retranslateUi(InitializeDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), InitializeDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), InitializeDialog.reject)
QtCore.QMetaObject.connectSlotsByName(InitializeDialog)