本文整理匯總了Python中PyQt4.QtGui.QWidget方法的典型用法代碼示例。如果您正苦於以下問題:Python QtGui.QWidget方法的具體用法?Python QtGui.QWidget怎麽用?Python QtGui.QWidget使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt4.QtGui
的用法示例。
在下文中一共展示了QtGui.QWidget方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: init
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QWidget [as 別名]
def init(self, num):
if self.mainwidget:
self.mainwidget.setParent(None)
self.mainwidget.deleteLater()
self.mainwidget = widgets.QWidget()
self.layout = widgets.QHBoxLayout()
self.layout.setSpacing(2)
self.bc = []
for i in range(num):
bc = Bit_container("00", i)
self.bc.append(bc)
self.layout.addWidget(bc)
self.mainwidget.setLayout(self.layout)
self.setWidget(self.mainwidget)
示例2: __init__
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QWidget [as 別名]
def __init__(self, *args, **kwargs):
super(Calculator, self).__init__(*args, **kwargs)
# Single-inheritence approach: http://goo.gl/WNiHc
# Calculator class only inherits from QWidget
# A specific member attribute self.ui contains all
# widgets set up in the designer.
self.ui = Ui_Calculator()
self.ui.setupUi(self)
self.ui.calcButton = QtGui.QPushButton("Calculate")
self.ui.horizontalLayout_2.addWidget(self.ui.calcButton)
# Create a validator for each QLineEdit that only
# allows a user to enter floats: 123.123
self.ui.inputA.setValidator(QtGui.QDoubleValidator())
self.ui.inputB.setValidator(QtGui.QDoubleValidator())
# instead of using the stock operator values set in the
# ui file, lets set the box to match our class attribute
self.ui.operatorBox.clear()
self.ui.operatorBox.addItems(self.OPS.keys())
self.ui.clearButton.clicked.connect(self.clear)
self.ui.calcButton.clicked.connect(self.calc)
示例3: eventFilter
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QWidget [as 別名]
def eventFilter(self, source, event):
"""
The event filter gets automatically installed when setWidget()
is called.
:param source:
:param event:
:return:
"""
if event.type() == QtCore.QEvent.Resize and source == self.widget():
# log.debug("VerticalScrollArea: Widget resized:")
# log.debug(" minimumSizeHint().width() = %d" % self.widget().minimumSizeHint().width())
# log.debug(" verticalScrollBar().width() = %d" % self.verticalScrollBar().width())
self.setMinimumWidth(self.widget().sizeHint().width() +
self.verticalScrollBar().sizeHint().width())
# if self.verticalScrollBar().isVisible():
# log.debug(" Scroll bar visible")
# self.setMinimumWidth(self.widget().minimumSizeHint().width() +
# self.verticalScrollBar().width())
# else:
# log.debug(" Scroll bar hidden")
# self.setMinimumWidth(self.widget().minimumSizeHint().width())
return QtGui.QWidget.eventFilter(self, source, event)
示例4: __init__
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QWidget [as 別名]
def __init__(self, app, parent=None):
"""
:param app: The application this tool will run in.
:type app: App
:param parent: Qt Parent
:return: FlatCAMTool
"""
QtGui.QWidget.__init__(self, parent)
# self.setSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Maximum)
self.layout = QtGui.QVBoxLayout()
self.setLayout(self.layout)
self.app = app
self.menuAction = None
示例5: quickMsg
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QWidget [as 別名]
def quickMsg(self, msg, block=1):
tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
tmpMsg.setWindowTitle("Info")
lineCnt = len(msg.split('\n'))
if lineCnt > 25:
scroll = QtWidgets.QScrollArea()
scroll.setWidgetResizable(1)
content = QtWidgets.QWidget()
scroll.setWidget(content)
layout = QtWidgets.QVBoxLayout(content)
tmpLabel = QtWidgets.QLabel(msg)
tmpLabel.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
layout.addWidget(tmpLabel)
tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
else:
tmpMsg.setText(msg)
if block == 0:
tmpMsg.setWindowModality( QtCore.Qt.NonModal )
tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
if block:
tmpMsg.exec_()
else:
tmpMsg.show()
示例6: quickMsg
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QWidget [as 別名]
def quickMsg(self, msg, block=1):
tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
tmpMsg.setWindowTitle("Info")
lineCnt = len(msg.split('\n'))
if lineCnt > 25:
scroll = QtWidgets.QScrollArea()
scroll.setWidgetResizable(1)
content = QtWidgets.QWidget()
scroll.setWidget(content)
layout = QtWidgets.QVBoxLayout(content)
layout.addWidget(QtWidgets.QLabel(msg))
tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
else:
tmpMsg.setText(msg)
if block == 0:
tmpMsg.setWindowModality( QtCore.Qt.NonModal )
tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
if block:
tmpMsg.exec_()
else:
tmpMsg.show()
示例7: setupUi
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QWidget [as 別名]
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(820, 650)
MainWindow.setAutoFillBackground(False)
MainWindow.setDocumentMode(False)
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setContentsMargins(-1, -1, 0, 0)
self.horizontalLayout.setSpacing(10)
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.btnAdd = QtGui.QPushButton(self.centralwidget)
self.btnAdd.setObjectName(_fromUtf8("btnAdd"))
self.horizontalLayout.addWidget(self.btnAdd)
self.chkMore = QtGui.QCheckBox(self.centralwidget)
self.chkMore.setObjectName(_fromUtf8("chkMore"))
self.horizontalLayout.addWidget(self.chkMore)
self.verticalLayout.addLayout(self.horizontalLayout)
self.matplotlibwidget = MatplotlibWidget(self.centralwidget)
self.matplotlibwidget.setObjectName(_fromUtf8("matplotlibwidget"))
self.verticalLayout.addWidget(self.matplotlibwidget)
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtGui.QStatusBar(MainWindow)
self.statusbar.setObjectName(_fromUtf8("statusbar"))
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
示例8: setupUi
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QWidget [as 別名]
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(993, 692)
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.horizontalLayout = QtGui.QHBoxLayout(self.centralwidget)
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.pbLevel = QtGui.QProgressBar(self.centralwidget)
self.pbLevel.setMaximum(1000)
self.pbLevel.setProperty("value", 123)
self.pbLevel.setTextVisible(False)
self.pbLevel.setOrientation(QtCore.Qt.Vertical)
self.pbLevel.setObjectName(_fromUtf8("pbLevel"))
self.horizontalLayout.addWidget(self.pbLevel)
self.frame = QtGui.QFrame(self.centralwidget)
self.frame.setFrameShape(QtGui.QFrame.NoFrame)
self.frame.setFrameShadow(QtGui.QFrame.Plain)
self.frame.setObjectName(_fromUtf8("frame"))
self.verticalLayout = QtGui.QVBoxLayout(self.frame)
self.verticalLayout.setMargin(0)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.label = QtGui.QLabel(self.frame)
self.label.setObjectName(_fromUtf8("label"))
self.verticalLayout.addWidget(self.label)
self.grFFT = PlotWidget(self.frame)
self.grFFT.setObjectName(_fromUtf8("grFFT"))
self.verticalLayout.addWidget(self.grFFT)
self.label_2 = QtGui.QLabel(self.frame)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.verticalLayout.addWidget(self.label_2)
self.grPCM = PlotWidget(self.frame)
self.grPCM.setObjectName(_fromUtf8("grPCM"))
self.verticalLayout.addWidget(self.grPCM)
self.horizontalLayout.addWidget(self.frame)
MainWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
示例9: setupUi
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QWidget [as 別名]
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(800, 600)
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.gridLayout = QtGui.QGridLayout(self.centralwidget)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.matplotlibwidget = MatplotlibWidget(self.centralwidget)
self.matplotlibwidget.setObjectName(_fromUtf8("matplotlibwidget"))
self.gridLayout.addWidget(self.matplotlibwidget, 0, 0, 1, 1)
MainWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
示例10: setupUi
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QWidget [as 別名]
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(820, 650)
MainWindow.setAutoFillBackground(False)
MainWindow.setDocumentMode(False)
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setContentsMargins(-1, -1, 0, 0)
self.horizontalLayout.setSpacing(10)
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.btnAdd = QtGui.QPushButton(self.centralwidget)
self.btnAdd.setObjectName(_fromUtf8("btnAdd"))
self.horizontalLayout.addWidget(self.btnAdd)
self.chkMore = QtGui.QCheckBox(self.centralwidget)
self.chkMore.setObjectName(_fromUtf8("chkMore"))
self.horizontalLayout.addWidget(self.chkMore)
self.verticalLayout.addLayout(self.horizontalLayout)
self.grPlot = PlotWidget(self.centralwidget)
self.grPlot.setObjectName(_fromUtf8("grPlot"))
self.verticalLayout.addWidget(self.grPlot)
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtGui.QStatusBar(MainWindow)
self.statusbar.setObjectName(_fromUtf8("statusbar"))
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
示例11: main
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QWidget [as 別名]
def main():
app = QtGui.QApplication(sys.argv)
w = QtGui.QWidget()
w.resize(250, 150)
w.move(300, 300)
w.setWindowTitle('Simple')
w.show()
sys.exit(app.exec_())
示例12: setupUi
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QWidget [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)
示例13: __init__
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QWidget [as 別名]
def __init__(self, db, binary):
QtGui.QWidget.__init__(self)
self.db = db
self.binary = binary
self.update_sections_coords()
p = self.palette()
p.setColor(self.backgroundRole(), COLOR_BACKGROUND)
self.setPalette(p)
self.setGeometry(200, 300, 1000, 100)
self.setWindowTitle("MEMORY MAP")
self.show()
示例14: __init__
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QWidget [as 別名]
def __init__(self):
"""
Initializes a new instance of this class.
"""
QtGui.QWidget.__init__(self)
#region Instance fields
self.previousSelectedNode = None
self.selectedSensor = None
self.selectedEncoding = None
self.selectedRegion = None
self.selectedColumn = None
self.selectedProximalSynapse = None
self.selectedCell = None
self.selectedDistalSegment = None
self.selectedDistalSynapse = None
# Predictions variables used for the predictions chart
self.currentValuesPlotItem = None
self.predictedValuesPlotItem = None
#endregion
self.initUI()
#endregion
#region Methods
示例15: __init__
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QWidget [as 別名]
def __init__(self, parent = None):
QtGui.QWidget.__init__(self, parent)
self.canvas = MplCanvas()
self.vbl = QtGui.QVBoxLayout()
self.vbl.addWidget(self.canvas)
self.setLayout(self.vbl)