本文整理汇总了Python中pyqtgraph.Qt.QtGui.QWidget方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QWidget方法的具体用法?Python QtGui.QWidget怎么用?Python QtGui.QWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqtgraph.Qt.QtGui
的用法示例。
在下文中一共展示了QtGui.QWidget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fromUi
# 需要导入模块: from pyqtgraph.Qt import QtGui [as 别名]
# 或者: from pyqtgraph.Qt.QtGui import QWidget [as 别名]
def fromUi(*args, **kwargs):
""" Returns a Qt object constructed using loadUiType
based on its arguments. All QWidget objects in the
form class are set in the returned object for easy
accessability.
"""
form_class, base_class = loadUiType(*args, **kwargs)
widget = base_class()
form = form_class()
form.setupUi(widget)
form.retranslateUi(widget)
for name in dir(form):
element = getattr(form, name)
if isinstance(element, QtGui.QWidget):
setattr(widget, name, element)
return widget
示例2: __init__
# 需要导入模块: from pyqtgraph.Qt import QtGui [as 别名]
# 或者: from pyqtgraph.Qt.QtGui import QWidget [as 别名]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.setFixedSize(QtCore.QSize(600, 400))
w = QtGui.QWidget()
self.setCentralWidget(w)
vlayout = QtGui.QVBoxLayout()
w.setLayout(vlayout)
self.htmlView = QtWidgets.QTextBrowser(self)
font = QtGui.QFont()
font.setFamily('Arial')
self.htmlView.setReadOnly(True)
self.htmlView.setFont(font)
self.htmlView.setOpenExternalLinks(True)
self.htmlView.setObjectName('Help information')
html_help_path = get_source_name('docs/help.html')
ret = self.htmlView.setSource(QtCore.QUrl(html_help_path))
print('load result:', ret)
# self.htmlView.append(ret)
vlayout.addWidget(self.htmlView)
示例3: __init__
# 需要导入模块: from pyqtgraph.Qt import QtGui [as 别名]
# 或者: from pyqtgraph.Qt.QtGui import QWidget [as 别名]
def __init__(self):
# Here, you should call the inherited class' init, which is QDialog
QtGui.QWidget.__init__(self)
print("UIFO - UI Info constructor")
# Window settings
#self.setWindowModality(QtCore.Qt.ApplicationModal)
self.setWindowTitle('Astibot Information')
self.setStyleSheet("background-color:#203044;")
self.setWindowIcon(QtGui.QIcon("AstibotIcon.png"))
self.setAutoFillBackground(True);
self.setFixedSize(1060, 750)
# Build layout
self.BuildWindowLayout()
示例4: initWindow
# 需要导入模块: from pyqtgraph.Qt import QtGui [as 别名]
# 或者: from pyqtgraph.Qt.QtGui import QWidget [as 别名]
def initWindow(self):
self.setWindowTitle('Real-time GCC-NMF')
self.mainWidget = QtGui.QWidget()
self.setCentralWidget(self.mainWidget)
self.backgroundColor = self.mainWidget.palette().color(QtGui.QPalette.Background)
self.borderColor = 'k'
self.mainWidget.setStyleSheet('QSplitter::handle {image: url(images/notExists.png); background-color: #D8D8D8}')
self.mainLayout = QtGui.QGridLayout()
self.mainWidget.setLayout(self.mainLayout)
self.mainWidget.setAutoFillBackground(True)
p = QtGui.QPalette(self.mainWidget.palette())
p.setColor(self.mainWidget.backgroundRole(), QtCore.Qt.black)
self.mainWidget.setPalette(p)
self.mainLayout.setContentsMargins(0, 0, 0, 0)
self.mainLayout.setSpacing(1)
示例5: initControlWidgets
# 需要导入模块: from pyqtgraph.Qt import QtGui [as 别名]
# 或者: from pyqtgraph.Qt.QtGui import QWidget [as 别名]
def initControlWidgets(self):
self.initMaskFunctionControls()
self.initMaskFunctionPlot()
self.initNMFControls()
self.initLocalizationControls()
self.initUIControls()
controlWidgetsLayout = QtGui.QVBoxLayout()
controlWidgetsLayout.addWidget(self.gccPHATPlotWidget)
controlWidgetsLayout.addLayout(self.maskFunctionControlslayout)
self.addSeparator(controlWidgetsLayout)
controlWidgetsLayout.addLayout(self.nmfControlsLayout)
controlWidgetsLayout.addLayout(self.localizationControlsLayout)
self.addSeparator(controlWidgetsLayout)
controlWidgetsLayout.addWidget(self.uiConrolsWidget)
self.controlsWidget = QtGui.QWidget()
self.controlsWidget.setLayout(controlWidgetsLayout)
self.controlsWidget.setAutoFillBackground(True)
示例6: initUIControls
# 需要导入模块: from pyqtgraph.Qt import QtGui [as 别名]
# 或者: from pyqtgraph.Qt.QtGui import QWidget [as 别名]
def initUIControls(self):
self.uiConrolsWidget = QtGui.QWidget()
buttonBarWidgetLayout = QtGui.QHBoxLayout(spacing=0)
buttonBarWidgetLayout.setContentsMargins(0, 0, 0, 0)
buttonBarWidgetLayout.setSpacing(0)
self.uiConrolsWidget.setLayout(buttonBarWidgetLayout)
def addButton(label, widget=None, function=None):
button = QtGui.QPushButton(label)
if function is None:
button.clicked.connect(lambda: widget.setVisible(widget.isHidden()))
else:
button.clicked.connect(function)
button.setStyleSheet('QPushButton {'
'border-color: black;'
'border-width: 5px;}')
buttonBarWidgetLayout.addWidget(button)
return button
addButton('Info', function=self.toggleInfoViews)
self.toggleSeparationButton = addButton(self.separationOnIconString, function=self.toggleSeparation)
self.playPauseButton = addButton(self.playIconString, function=self.togglePlay)
示例7: __init__
# 需要导入模块: from pyqtgraph.Qt import QtGui [as 别名]
# 或者: from pyqtgraph.Qt.QtGui import QWidget [as 别名]
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.ui = Ui_Form()
self.cw = QtGui.QWidget()
self.setCentralWidget(self.cw)
self.ui.setupUi(self.cw)
self.codeBtn = QtGui.QPushButton('Run Edited Code')
self.codeLayout = QtGui.QGridLayout()
self.ui.codeView.setLayout(self.codeLayout)
self.codeLayout.addItem(QtGui.QSpacerItem(100,100,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding), 0, 0)
self.codeLayout.addWidget(self.codeBtn, 1, 1)
self.codeBtn.hide()
global examples
self.itemCache = []
self.populateTree(self.ui.exampleTree.invisibleRootItem(), examples)
self.ui.exampleTree.expandAll()
self.resize(1000,500)
self.show()
self.ui.splitter.setSizes([250,750])
self.ui.loadBtn.clicked.connect(self.loadFile)
self.ui.exampleTree.currentItemChanged.connect(self.showFile)
self.ui.exampleTree.itemDoubleClicked.connect(self.loadFile)
self.ui.codeView.textChanged.connect(self.codeEdited)
self.codeBtn.clicked.connect(self.runEditedCode)
示例8: __init__
# 需要导入模块: from pyqtgraph.Qt import QtGui [as 别名]
# 或者: from pyqtgraph.Qt.QtGui import QWidget [as 别名]
def __init__(self):
QtGui.QWidget.__init__(self)
self.animations = []
self.animTimer = QtCore.QTimer()
self.animTimer.timeout.connect(self.stepAnimation)
self.animTime = 0
self.animDt = .016
self.lastAnimTime = 0
self.setupGUI()
self.objectGroup = ObjectGroupParam()
self.params = Parameter.create(name='params', type='group', children=[
dict(name='Load Preset..', type='list', values=[]),
#dict(name='Unit System', type='list', values=['', 'MKS']),
dict(name='Duration', type='float', value=10.0, step=0.1, limits=[0.1, None]),
dict(name='Reference Frame', type='list', values=[]),
dict(name='Animate', type='bool', value=True),
dict(name='Animation Speed', type='float', value=1.0, dec=True, step=0.1, limits=[0.0001, None]),
dict(name='Recalculate Worldlines', type='action'),
dict(name='Save', type='action'),
dict(name='Load', type='action'),
self.objectGroup,
])
self.tree.setParameters(self.params, showTop=False)
self.params.param('Recalculate Worldlines').sigActivated.connect(self.recalculate)
self.params.param('Save').sigActivated.connect(self.save)
self.params.param('Load').sigActivated.connect(self.load)
self.params.param('Load Preset..').sigValueChanged.connect(self.loadPreset)
self.params.sigTreeStateChanged.connect(self.treeChanged)
## read list of preset configs
presetDir = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), 'presets')
if os.path.exists(presetDir):
presets = [os.path.splitext(p)[0] for p in os.listdir(presetDir)]
self.params.param('Load Preset..').setLimits(['']+presets)
示例9: __init__
# 需要导入模块: from pyqtgraph.Qt import QtGui [as 别名]
# 或者: from pyqtgraph.Qt.QtGui import QWidget [as 别名]
def __init__(self, parent=None, size=(5.0, 4.0), dpi=100):
QtGui.QWidget.__init__(self)
super(MatplotlibWidget, self).__init__(parent)
self.fig = Figure(size, dpi=dpi)
self.canvas = FigureCanvas(self.fig)
self.canvas.setParent(self)
# self.toolbar = NavigationToolbar(self.canvas, self)
self.vbox = QtGui.QVBoxLayout()
# self.vbox.addWidget(self.toolbar)
self.vbox.addWidget(self.canvas)
self.setLayout(self.vbox)
示例10: __init__
# 需要导入模块: from pyqtgraph.Qt import QtGui [as 别名]
# 或者: from pyqtgraph.Qt.QtGui import QWidget [as 别名]
def __init__(self, settings):
# Here, you should call the inherited class' init, which is QDialog
QtGui.QWidget.__init__(self)
print("UIST - UI Settings constructor")
# Application settings data instance
self.theSettings = settings
# Window settings
self.setWindowModality(QtCore.Qt.ApplicationModal)
self.setWindowTitle('Astibot Settings')
self.setStyleSheet("background-color:#203044;")
self.setWindowIcon(QtGui.QIcon("AstibotIcon.png"))
self.setAutoFillBackground(True);
self.setFixedSize(646, 610)
# Build layout
self.BuildWindowLayout()
# Timer to make API textboxes blink
self.timerBlinkStuffs = QtCore.QTimer()
self.timerBlinkStuffs.timeout.connect(self.TimerRaisedBlinkStuff)
self.blinkIsOn = False
self.blinkCounter = 0
# Apply saved (or default) settings
self.ApplySettings()
示例11: __init__
# 需要导入模块: from pyqtgraph.Qt import QtGui [as 别名]
# 或者: from pyqtgraph.Qt.QtGui import QWidget [as 别名]
def __init__(self, settings):
# Here, you should call the inherited class' init, which is QDialog
QtGui.QWidget.__init__(self)
print("UIDO - UI Donating constructor")
# Application settings data instance
self.theSettings = settings
# Functional
self.BTCBalance = -1.0
self.windowIsShown = False
self.timerRefreshBTCBalance = QtCore.QTimer()
self.timerRefreshBTCBalance.timeout.connect(self.TimerRaisedRefreshBTCBalance)
self.timerRefreshBTCBalance.start(200)
self.withdrawHasBeenPerformed = False
# Window settings
self.setWindowModality(QtCore.Qt.ApplicationModal)
self.setWindowTitle('Astibot')
self.setStyleSheet("background-color:#203044;")
self.setWindowIcon(QtGui.QIcon("AstibotIcon.png"))
self.setAutoFillBackground(True);
self.setFixedSize(450, 350)
# Build layout
self.BuildWindowLayout()
示例12: __init__
# 需要导入模块: from pyqtgraph.Qt import QtGui [as 别名]
# 或者: from pyqtgraph.Qt.QtGui import QWidget [as 别名]
def __init__(self, width=300, height=300):
QtGui.QWidget.__init__(self)
self.image = None
self.lut=None
self.init(width, height)
示例13: widget
# 需要导入模块: from pyqtgraph.Qt import QtGui [as 别名]
# 或者: from pyqtgraph.Qt.QtGui import QWidget [as 别名]
def widget(self):
w = QtGui.QWidget()
layout = QtGui.QGridLayout()
w.setLayout(layout)
layout.addWidget(self.OSC1.widget(), 0, 0)
layout.addWidget(self.OSC2.widget(), 1, 0)
layout.addWidget(self.OSC3.widget(), 2, 0)
layout.addWidget(self.Spec.widget(), 0, 1, 3, 1)
return w
示例14: widget
# 需要导入模块: from pyqtgraph.Qt import QtGui [as 别名]
# 或者: from pyqtgraph.Qt.QtGui import QWidget [as 别名]
def widget(self):
w = QtGui.QWidget()
layout = QtGui.QGridLayout()
w.setLayout(layout)
layout.addWidget(self.OSC1.widget(), 0, 0)
layout.addWidget(self.OSC2.widget(), 1, 0)
layout.addWidget(self.OSC3.widget(), 2, 0)
layout.addWidget(self.OSC4.widget(), 3, 0)
layout.addWidget(self.Spec.widget(), 0, 1, 3, 1)
layout.addWidget(self.DCOSC.widget(), 3, 1)
return w
示例15: widget
# 需要导入模块: from pyqtgraph.Qt import QtGui [as 别名]
# 或者: from pyqtgraph.Qt.QtGui import QWidget [as 别名]
def widget(self):
w = QtGui.QWidget()
layout = QtGui.QGridLayout()
w.setLayout(layout)
layout.addWidget(self.OSC1.widget(), 0, 0)
layout.addWidget(self.OSC2.widget(), 1, 0)
layout.addWidget(self.OSC3.widget(), 2, 0)
layout.addWidget(self.OSC4.widget(), 3, 0)
layout.addWidget(self.Spec.widget(), 0, 1, 4, 1)
return w