本文整理汇总了Python中PyQt4.QtGui.QTextEdit方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QTextEdit方法的具体用法?Python QtGui.QTextEdit怎么用?Python QtGui.QTextEdit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui
的用法示例。
在下文中一共展示了QtGui.QTextEdit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initUI
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QTextEdit [as 别名]
def initUI(self):
self.text_show2 = QtGui.QTextEdit()
self.text_show2.setText(SHOW2STR)
self.text_show2.setReadOnly(True)
self.text_hex = QtGui.QTextEdit()
self.text_hex.setText(HEXSTR)
self.text_hex.setReadOnly(True)
self.save_but = QtGui.QPushButton(u'保存为PDF', self)
self.save_but.setCheckable(False)
self.save_but.clicked.connect(self.save_pdf)
vbox = QtGui.QVBoxLayout()
vbox.addWidget(self.text_show2)
vbox.addWidget(self.text_hex)
vbox.addWidget(self.save_but)
self.setLayout(vbox)
"""
self.splitter = QtGui.QSplitter(self)
self.splitter.addWidget(self.text_show2)
self.splitter.addWidget(self.text_hex)
self.splitter.setOrientation(QtCore.Qt.Vertical)
"""
示例2: setupUi
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QTextEdit [as 别名]
def setupUi(self, EmoticonDialog):
EmoticonDialog.setObjectName(_fromUtf8("EmoticonDialog"))
EmoticonDialog.resize(300, 500)
self.verticalLayout = QtGui.QVBoxLayout(EmoticonDialog)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.label = QtGui.QLabel(EmoticonDialog)
self.label.setObjectName(_fromUtf8("label"))
self.verticalLayout.addWidget(self.label)
self.uiEmoticonTextEdit = QtGui.QTextEdit(EmoticonDialog)
self.uiEmoticonTextEdit.setObjectName(_fromUtf8("uiEmoticonTextEdit"))
self.verticalLayout.addWidget(self.uiEmoticonTextEdit)
self.buttonBox = QtGui.QDialogButtonBox(EmoticonDialog)
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(EmoticonDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), EmoticonDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), EmoticonDialog.reject)
QtCore.QMetaObject.connectSlotsByName(EmoticonDialog)
示例3: initUI
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QTextEdit [as 别名]
def initUI(self):
self.text = QtGui.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"))
示例4: addTextEdit
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QTextEdit [as 别名]
def addTextEdit(self, text, readOnly=True, startsVisible=True, oneLine=False):
if oneLine:
textEdit = QtGui.QLineEdit()
else:
textEdit = QtGui.QTextEdit()
load_css_for_widget(textEdit, os.path.join(css_path, 'textedit.css'))
if readOnly:
textEdit.setText(text)
else:
textEdit.setPlaceholderText(text)
textEdit.setReadOnly(readOnly)
textEdit.setGeometry(100, 100, 800, 600)
textEdit.setVisible(startsVisible)
return textEdit
示例5: setupUi
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QTextEdit [as 别名]
def setupUi(self, Dialog):
Dialog.setObjectName(_fromUtf8("Dialog"))
Dialog.resize(400, 300)
self.verticalLayout = QtGui.QVBoxLayout(Dialog)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.textEdit = QtGui.QTextEdit(Dialog)
self.textEdit.setReadOnly(True)
self.textEdit.setObjectName(_fromUtf8("textEdit"))
self.verticalLayout.addWidget(self.textEdit)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.ExitButton = QtGui.QPushButton(Dialog)
self.ExitButton.setObjectName(_fromUtf8("ExitButton"))
self.horizontalLayout.addWidget(self.ExitButton)
spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem1)
self.verticalLayout.addLayout(self.horizontalLayout)
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
示例6: setupUi
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QTextEdit [as 别名]
def setupUi(self, MemoEdit):
'''被memoedit调用'''
MemoEdit.setFixedWidth(400)
'''初始化组件'''
self.titleEdit = QtGui.QLineEdit()
self.timeEdit = QtGui.QDateTimeEdit()
self.contentEdit = QtGui.QTextEdit()
self.okBtn = QtGui.QPushButton(_fromUtf8("确定"))
self.layout = QtGui.QVBoxLayout()
'''设置组件大小属性'''
self.layout.setMargin(0)
self.layout.setSpacing(0)
''' 设置stylesheet'''
'''设置布局'''
self.layout.addWidget(self.titleEdit)
self.layout.addWidget(self.timeEdit)
self.layout.addWidget(self.contentEdit)
self.layout.addWidget(self.okBtn)
self.setLayout(self.layout)
示例7: __init__
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QTextEdit [as 别名]
def __init__(self):
super(NikeAddAccount, self).__init__()
self.setWindowModality(QtCore.Qt.ApplicationModal)
self.setWindowTitle("账号添加")
self.setFixedSize(500, 400)
self.label = QtGui.QLabel(' 以空格/逗号/冒号为分界线,一个账号一行,例:\nabc@qq.com 123456 42或abc@qq.com,123456或abc@qq.com:123456:42 ', self)
self.line = QtGui.QTextEdit(self)
self.button_add = QtGui.QPushButton('添加账号', self)
self.button_clear = QtGui.QPushButton('清空账号', self)
hbox = QtGui.QHBoxLayout()
hbox.addStretch(3)
hbox.addWidget(self.button_add)
hbox.addWidget(self.button_clear)
vbox = QtGui.QVBoxLayout()
vbox.addWidget(self.label)
vbox.addWidget(self.line)
vbox.addLayout(hbox)
self.setLayout(vbox)
示例8: setupUi
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QTextEdit [as 别名]
def setupUi(self, qgpkgDlg):
qgpkgDlg.setObjectName(_fromUtf8("qgpkgDlg"))
qgpkgDlg.resize(456, 358)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/QgisGeopackage/about.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
qgpkgDlg.setWindowIcon(icon)
self.verticalLayout = QtGui.QVBoxLayout(qgpkgDlg)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.textEdit = QtGui.QTextEdit(qgpkgDlg)
self.textEdit.setReadOnly(True)
self.textEdit.setObjectName(_fromUtf8("textEdit"))
self.verticalLayout.addWidget(self.textEdit)
self.button_box = QtGui.QDialogButtonBox(qgpkgDlg)
self.button_box.setOrientation(QtCore.Qt.Horizontal)
self.button_box.setStandardButtons(QtGui.QDialogButtonBox.Close)
self.button_box.setObjectName(_fromUtf8("button_box"))
self.verticalLayout.addWidget(self.button_box)
self.retranslateUi(qgpkgDlg)
QtCore.QObject.connect(self.button_box, QtCore.SIGNAL(_fromUtf8("accepted()")), qgpkgDlg.accept)
QtCore.QObject.connect(self.button_box, QtCore.SIGNAL(_fromUtf8("rejected()")), qgpkgDlg.reject)
QtCore.QMetaObject.connectSlotsByName(qgpkgDlg)
示例9: moveCursor
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QTextEdit [as 别名]
def moveCursor(self,start,end):
# We retrieve the QTextCursor object from the parent's QTextEdit
cursor = self.parent.text.textCursor()
# Then we set the position to the beginning of the last match
cursor.setPosition(start)
# Next we move the cursor over the match and pass the KeepAnchor parameter
# which will make the cursor select the the match's text
cursor.movePosition(QtGui.QTextCursor.Right,QtGui.QTextCursor.KeepAnchor,end - start)
# And finally we set this new cursor as the parent's
self.parent.text.setTextCursor(cursor)
示例10: setupUi
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QTextEdit [as 别名]
def setupUi(self, Form):
Form.setObjectName(_fromUtf8("Form"))
Form.resize(529, 329)
self.selInfoWidget = QtGui.QWidget(Form)
self.selInfoWidget.setGeometry(QtCore.QRect(260, 10, 264, 222))
self.selInfoWidget.setObjectName(_fromUtf8("selInfoWidget"))
self.gridLayout = QtGui.QGridLayout(self.selInfoWidget)
self.gridLayout.setMargin(0)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.selDescLabel = QtGui.QLabel(self.selInfoWidget)
self.selDescLabel.setText(_fromUtf8(""))
self.selDescLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.selDescLabel.setWordWrap(True)
self.selDescLabel.setObjectName(_fromUtf8("selDescLabel"))
self.gridLayout.addWidget(self.selDescLabel, 0, 0, 1, 1)
self.selNameLabel = QtGui.QLabel(self.selInfoWidget)
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.selNameLabel.setFont(font)
self.selNameLabel.setText(_fromUtf8(""))
self.selNameLabel.setObjectName(_fromUtf8("selNameLabel"))
self.gridLayout.addWidget(self.selNameLabel, 0, 1, 1, 1)
self.selectedTree = DataTreeWidget(self.selInfoWidget)
self.selectedTree.setObjectName(_fromUtf8("selectedTree"))
self.selectedTree.headerItem().setText(0, _fromUtf8("1"))
self.gridLayout.addWidget(self.selectedTree, 1, 0, 1, 2)
self.hoverText = QtGui.QTextEdit(Form)
self.hoverText.setGeometry(QtCore.QRect(0, 240, 521, 81))
self.hoverText.setObjectName(_fromUtf8("hoverText"))
self.view = FlowchartGraphicsView(Form)
self.view.setGeometry(QtCore.QRect(0, 0, 256, 192))
self.view.setObjectName(_fromUtf8("view"))
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
示例11: initUI
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QTextEdit [as 别名]
def initUI(self):
self.text = QtGui.QTextEdit(self)
self.initToolbar()
self.initFormatbar()
self.initMenubar()
# Set the tab stop width to around 33 pixels which is
# about 8 spaces
self.text.setTabStopWidth(33)
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)
# x and y coordinates on the screen, width, height
self.setGeometry(100,100,1030,800)
self.setWindowTitle("Writer")
self.setWindowIcon(QtGui.QIcon("icons/icon.png"))
示例12: moveCursor
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QTextEdit [as 别名]
def moveCursor(self,start,end):
# We retrieve the QTextCursor object from the parent's QTextEdit
cursor = self.parent.text.textCursor()
# Then we set the position to the beginning of the last match
cursor.setPosition(start)
# Next we move the Cursor by over the match and pass the KeepAnchor parameter
# which will make the cursor select the the match's text
cursor.movePosition(QtGui.QTextCursor.Right,QtGui.QTextCursor.KeepAnchor,end - start)
# And finally we set this new cursor as the parent's
self.parent.text.setTextCursor(cursor)
示例13: setupUi
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QTextEdit [as 别名]
def setupUi(self, BatchAdd):
BatchAdd.setObjectName(_fromUtf8("BatchAdd"))
BatchAdd.setWindowModality(QtCore.Qt.NonModal)
BatchAdd.resize(400, 300)
BatchAdd.setMaximumSize(QtCore.QSize(400, 16777215))
BatchAdd.setModal(False)
self.verticalLayout_2 = QtGui.QVBoxLayout(BatchAdd)
self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
self.verticalWidget = QtGui.QWidget(BatchAdd)
self.verticalWidget.setObjectName(_fromUtf8("verticalWidget"))
self.verticalLayout = QtGui.QVBoxLayout(self.verticalWidget)
self.verticalLayout.setMargin(0)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.UrlList = QtGui.QTextEdit(self.verticalWidget)
self.UrlList.setObjectName(_fromUtf8("UrlList"))
self.verticalLayout.addWidget(self.UrlList)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.Browse = QtGui.QPushButton(self.verticalWidget)
self.Browse.setObjectName(_fromUtf8("Browse"))
self.horizontalLayout.addWidget(self.Browse)
self.Add = QtGui.QPushButton(self.verticalWidget)
self.Add.setObjectName(_fromUtf8("Add"))
self.horizontalLayout.addWidget(self.Add)
self.Close = QtGui.QPushButton(self.verticalWidget)
self.Close.setObjectName(_fromUtf8("Close"))
self.horizontalLayout.addWidget(self.Close)
self.verticalLayout.addLayout(self.horizontalLayout)
self.verticalLayout_2.addWidget(self.verticalWidget)
self.retranslateUi(BatchAdd)
QtCore.QMetaObject.connectSlotsByName(BatchAdd)
示例14: setupUi
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QTextEdit [as 别名]
def setupUi(self, frmAbout):
frmAbout.setObjectName(_fromUtf8("frmAbout"))
frmAbout.resize(718, 541)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(frmAbout.sizePolicy().hasHeightForWidth())
frmAbout.setSizePolicy(sizePolicy)
frmAbout.setLayoutDirection(QtCore.Qt.LeftToRight)
self.gridLayout = QtGui.QGridLayout(frmAbout)
self.gridLayout.setMargin(9)
self.gridLayout.setSpacing(6)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.txtAbout = QtGui.QTextEdit(frmAbout)
self.txtAbout.setReadOnly(True)
self.txtAbout.setObjectName(_fromUtf8("txtAbout"))
self.gridLayout.addWidget(self.txtAbout, 0, 0, 1, 2)
self.btnSTDMHome = QtGui.QPushButton(frmAbout)
self.btnSTDMHome.setMinimumSize(QtCore.QSize(0, 30))
self.btnSTDMHome.setObjectName(_fromUtf8("btnSTDMHome"))
self.gridLayout.addWidget(self.btnSTDMHome, 1, 0, 1, 1)
self.btnContactUs = QtGui.QPushButton(frmAbout)
self.btnContactUs.setMinimumSize(QtCore.QSize(0, 30))
self.btnContactUs.setObjectName(_fromUtf8("btnContactUs"))
self.gridLayout.addWidget(self.btnContactUs, 1, 1, 1, 1)
self.buttonBox = QtGui.QDialogButtonBox(frmAbout)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Close)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.gridLayout.addWidget(self.buttonBox, 2, 0, 1, 2)
self.retranslateUi(frmAbout)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), frmAbout.reject)
QtCore.QMetaObject.connectSlotsByName(frmAbout)
示例15: createTestEditor
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QTextEdit [as 别名]
def createTestEditor(self):
"""This function create widget for Library Editor"""
global count
self.testWidget = QtGui.QWidget()
self.testArea = QtGui.QTextEdit()
self.testLayout = QtGui.QVBoxLayout()
self.testLayout.addWidget(self.testArea)
# Adding to main Layout
self.testWidget.setLayout(self.testLayout)
dock['Tips-' + str(count)] = QtGui.QDockWidget('Tips-' + str(count))
dock['Tips-' + str(count)].setWidget(self.testWidget)
self.addDockWidget(QtCore.Qt.TopDockWidgetArea,
dock['Tips-' + str(count)])
self.tabifyDockWidget(
dock['Welcome'], dock['Tips-' + str(count)])
dock['Tips-' + str(count)].setVisible(True)
dock['Tips-' + str(count)].setFocus()
dock['Tips-' + str(count)].raise_()
temp = self.obj_appconfig.current_project['ProjectName']
if temp:
self.obj_appconfig.dock_dict[temp].append(
dock['Tips-' + str(count)]
)
count = count + 1