本文整理汇总了Python中PyQt5.QtGui.QVBoxLayout方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QVBoxLayout方法的具体用法?Python QtGui.QVBoxLayout怎么用?Python QtGui.QVBoxLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtGui
的用法示例。
在下文中一共展示了QtGui.QVBoxLayout方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _addIndicatorLabels
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QVBoxLayout [as 别名]
def _addIndicatorLabels(self,Form,sizePolicy,indicators=[]):
self.IndicatorLayout = QtGui.QVBoxLayout()
self.IndicatorLayout.setSizeConstraint(QtGui.QLayout.SetMinimumSize)
self.IndicatorLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.IndicatorLayout.setContentsMargins(0,0,0,0)
self.IndicatorLayout.setContentsMargins(QtCore.QMargins(0,0,0,0))
self.IndicatorLayout.setSpacing(3)
for indicator in indicators:
setattr(self,indicator,QtGui.QLabel(Form))
temp_indicator = getattr(self,indicator)
temp_indicator.setSizePolicy(sizePolicy)
temp_indicator.setObjectName(_fromUtf8(indicator))
self.IndicatorLayout.addWidget(temp_indicator)
self.horizontalLayout.addLayout(self.IndicatorLayout,stretch = -10)
示例2: init_external_tab_ui
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QVBoxLayout [as 别名]
def init_external_tab_ui(self):
"""External data."""
self.external_tab = QtGui.QWidget()
self.external_tab.setEnabled(False)
self.external_layout = QtGui.QVBoxLayout(self.external_tab)
self.import_data_name = QtGui.QLabel('Import External Data')
self.import_data_label = QtGui.QLabel('...')
self.import_data_btn = QtGui.QPushButton('Import')
self.import_data_btn.clicked.connect(self.open_file)
self.external_layout.addWidget(
self.import_data_name, 0, QtCore.Qt.AlignCenter
)
self.external_layout.addWidget(
self.import_data_label, 0, QtCore.Qt.AlignCenter
)
self.external_layout.addWidget(
self.import_data_btn, 0, QtCore.Qt.AlignCenter
)
self.select_source.addTab(self.external_tab, 'Custom data')
示例3: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QVBoxLayout [as 别名]
def __init__(self, parent=None):
super().__init__(parent)
self.layout = QtGui.QVBoxLayout(self)
self.layout.setContentsMargins(0, 0, 0, 0)
self.table_layout = QtGui.QHBoxLayout()
self.top_layout = QtGui.QHBoxLayout()
self.top_layout.setContentsMargins(0, 10, 0, 0)
self.start_optimization_btn = QtGui.QPushButton('Start')
self.start_optimization_btn.clicked.connect(self.start_optimization)
self.top_layout.addWidget(
self.start_optimization_btn, alignment=QtCore.Qt.AlignRight
)
self.layout.addLayout(self.top_layout)
self.layout.addLayout(self.table_layout)
示例4: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QVBoxLayout [as 别名]
def __init__(self):
super().__init__()
self.signals_visible = False
self.style = ChartType.CANDLESTICK
self.indicators = []
self.xaxis = DateAxis(orientation='bottom')
self.xaxis.setStyle(
tickTextOffset=7, textFillLimits=[(0, 0.80)], showValues=False
)
self.xaxis_ind = DateAxis(orientation='bottom')
self.xaxis_ind.setStyle(tickTextOffset=7, textFillLimits=[(0, 0.80)])
self.layout = QtGui.QVBoxLayout(self)
self.layout.setContentsMargins(0, 0, 0, 0)
self.splitter = QtGui.QSplitter(QtCore.Qt.Vertical)
self.splitter.setHandleWidth(4)
self.layout.addWidget(self.splitter)
示例5: tabbed_qt4_window
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QVBoxLayout [as 别名]
def tabbed_qt4_window(self):
from PyQt4 import QtGui
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg, NavigationToolbar2QT
# mpl backend can already create instance
# https://stackoverflow.com/a/40031190
app = QtGui.QApplication.instance()
if app is None:
app = QtGui.QApplication([self.title])
self.root_window = QtGui.QTabWidget()
self.root_window.setWindowTitle(self.title)
for name, fig in self.figures.items():
tab = QtGui.QWidget(self.root_window)
tab.canvas = FigureCanvasQTAgg(fig)
vbox = QtGui.QVBoxLayout(tab)
vbox.addWidget(tab.canvas)
toolbar = NavigationToolbar2QT(tab.canvas, tab)
vbox.addWidget(toolbar)
tab.setLayout(vbox)
for axes in fig.get_axes():
if isinstance(axes, Axes3D):
# must explicitly allow mouse dragging for 3D plots
axes.mouse_init()
self.root_window.addTab(tab, name)
self.root_window.show()
app.exec_()
示例6: tabbed_qt5_window
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QVBoxLayout [as 别名]
def tabbed_qt5_window(self):
from PyQt5 import QtGui, QtWidgets
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg, NavigationToolbar2QT
# mpl backend can already create instance
# https://stackoverflow.com/a/40031190
app = QtGui.QGuiApplication.instance()
if app is None:
app = QtWidgets.QApplication([self.title])
self.root_window = QtWidgets.QTabWidget()
self.root_window.setWindowTitle(self.title)
for name, fig in self.figures.items():
tab = QtWidgets.QWidget(self.root_window)
tab.canvas = FigureCanvasQTAgg(fig)
vbox = QtWidgets.QVBoxLayout(tab)
vbox.addWidget(tab.canvas)
toolbar = NavigationToolbar2QT(tab.canvas, tab)
vbox.addWidget(toolbar)
tab.setLayout(vbox)
for axes in fig.get_axes():
if isinstance(axes, Axes3D):
# must explicitly allow mouse dragging for 3D plots
axes.mouse_init()
self.root_window.addTab(tab, name)
self.root_window.show()
app.exec_()
示例7: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QVBoxLayout [as 别名]
def __init__(self, parent_plot):
QtGui.QWidget.__init__(self)
self.parent_plot = parent_plot
self.model = parent_plot.model
self.plot = pg.PlotWidget(background='default')
self.plot.showGrid(True, True, alpha=.5)
self.plot.setMenuEnabled(True)
self.plot.enableAutoRange()
self.layout = QtGui.QVBoxLayout(self)
self.layout.addWidget(self.plot)
示例8: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QVBoxLayout [as 别名]
def __init__(self, horizontal=True, parent=None, decimals=3, step=.005,
slider_exponent=1):
QtGui.QWidget.__init__(self, parent)
self.vmin = None
self.vmax = None
self.slider_exponent = slider_exponent
self.decimals = decimals
self.step = 100
self.valueLen = 2
self.suffix = None
self._value = None
self.spin = QtGui.QDoubleSpinBox()
self.spin.setDecimals(decimals)
self.spin.setSingleStep(step)
self.spin.valueChanged.connect(self._spin_updated)
self.spin.setFrame(False)
self.slider = QtGui.QSlider(
QtCore.Qt.Orientation(1 if horizontal else 0), self) # 1 = hor.
self.slider.setTickPosition(
QtGui.QSlider.TicksAbove if horizontal
else QtGui.QSlider.TicksLeft)
self.slider.setRange(0, 99)
self.slider.sliderMoved.connect(self._slider_updated)
layout = QtGui.QHBoxLayout() if horizontal else QtGui.QVBoxLayout()
self.setLayout(layout)
layout.addWidget(self.slider)
layout.addWidget(self.spin)
示例9: get_QVBoxLayout
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QVBoxLayout [as 别名]
def get_QVBoxLayout():
"""QVBoxLayout getter."""
try:
import PySide.QtGui as QtGui
return QtGui.QVBoxLayout
except ImportError:
import PyQt5.QtWidgets as QtWidgets
return QtWidgets.QVBoxLayout
示例10: _addTraceSelectorIndicator
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QVBoxLayout [as 别名]
def _addTraceSelectorIndicator(self,Form,sizePolicy,TraceSelector = "", TraceIndicator="", prefix = "Trace: "):
self.TraceSelIndLayout = QtGui.QVBoxLayout()
self.TraceSelIndLayout.setSizeConstraint(QtGui.QLayout.SetMinimumSize)
self.TraceSelIndLayout.setObjectName(_fromUtf8("TraceSelIndLayout"))
self.TraceSelIndLayout.setContentsMargins(0,0,0,0)
self.TraceSelIndLayout.setContentsMargins(QtCore.QMargins(0,0,0,0))
self.TraceSelIndLayout.setSpacing(1)
setattr(self,TraceSelector,QtGui.QSpinBox(Form))
temp_SelInd = getattr(self,TraceSelector)
temp_SelInd.setSizePolicy(sizePolicy)
temp_SelInd.setSuffix(_fromUtf8(""))
temp_SelInd.setMinimum(-99999)
temp_SelInd.setMaximum(99999)
temp_SelInd.setProperty("value", -1)
temp_SelInd.setObjectName(_fromUtf8(TraceSelector))
temp_SelInd.setPrefix(_translate("Form", prefix , None))
self.TraceSelIndLayout.addWidget(temp_SelInd)
setattr(self,TraceIndicator,QtGui.QLineEdit(Form))
temp_SelInd = getattr(self,TraceIndicator)
temp_SelInd.setSizePolicy(sizePolicy)
temp_SelInd.setReadOnly(False)
temp_SelInd.setObjectName(_fromUtf8("TraceValue"))
self.TraceSelIndLayout.addWidget(temp_SelInd)
self.horizontalLayout.addLayout(self.TraceSelIndLayout,stretch = -10)
示例11: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QVBoxLayout [as 别名]
def __init__(self, nAxes, parent = None):
QtGui.QWidget.__init__(self, parent)
self.canvas = OverlapCanvas(nAxes)
self.vbl = QtGui.QVBoxLayout()
self.vbl.addWidget(self.canvas)
self.setLayout(self.vbl)
示例12: setupMatrix
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QVBoxLayout [as 别名]
def setupMatrix(self,Form):
"""Set up slots for value_matrix.
The data can be plotted color coded as a 2d plot, as a 1d plot at a
user selected value of the x_axis or the numerical values can be
displayed in a table.
Args:
self: Object of the Ui_Form class.
Form: PlotWindow object that inherits the used calls here from the
underlying QWidget class.
Returns:
No return variable. The function operates on the given object.
"""
self.PlotTypeSelector = QtGui.QComboBox(Form)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.PlotTypeSelector.sizePolicy().hasHeightForWidth())
self.PlotTypeSelector.setSizePolicy(sizePolicy)
self.PlotTypeSelector.setObjectName(_fromUtf8("PlotTypeSelector"))
self.PlotTypeSelector.addItem(_fromUtf8(""))
self.PlotTypeSelector.addItem(_fromUtf8(""))
self.PlotTypeSelector.addItem(_fromUtf8(""))
self.PlotTypeSelector.addItem(_fromUtf8(""))
self.PlotTypeSelector.setItemText(0, _translate("Form", "Color Plot", None))
self.PlotTypeSelector.setItemText(1, _translate("Form", "Line Plot X", None))
self.PlotTypeSelector.setItemText(2, _translate("Form", "Line Plot Y", None))
self.PlotTypeSelector.setItemText(3, _translate("Form", "Table", None))
self.PlotTypeLayout = QtGui.QVBoxLayout()
self.PlotTypeLayout.addWidget(self.PlotTypeSelector)
# add a empty label to move the PlotTypeSelector to the top
emptyL = QtGui.QLabel(Form)
self.PlotTypeLayout.addWidget(emptyL)
self.horizontalLayout.addLayout(self.PlotTypeLayout,stretch = -10)
self._addTraceSelectorIndicator(Form,sizePolicy,TraceSelector = "TraceXSelector",
TraceIndicator="TraceXValue", prefix = self.selector_labels[0]+': ')
self._addTraceSelectorIndicator(Form,sizePolicy,TraceSelector = "TraceYSelector",
TraceIndicator="TraceYValue", prefix = self.selector_labels[1]+': ')
#The indicators should be located at the most right side of the bar
spacerItem = QtGui.QSpacerItem(40, 1, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self._addIndicatorLabels(Form,sizePolicy, indicators=["PointX","PointY","PointZ"])
示例13: setupBox
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QVBoxLayout [as 别名]
def setupBox(self,Form):
"""Set up slots for value_box.
The data can be plotted color coded as a 2d plot at a user selected
value of either the x_, y_ or z_axis or as a 1d plot at a user selected
value of the x_ and y_axis.
Args:
self: Object of the Ui_Form class.
Form: PlotWindow object that inherits the used calls here from the
underlying QWidget class.
Returns:
No return variable. The function operates on the given object.
"""
self.PlotTypeSelector = QtGui.QComboBox(Form)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.PlotTypeSelector.sizePolicy().hasHeightForWidth())
self.PlotTypeSelector.setSizePolicy(sizePolicy)
self.PlotTypeSelector.setObjectName(_fromUtf8("PlotTypeSelector"))
self.PlotTypeSelector.addItem(_fromUtf8(""))
self.PlotTypeSelector.addItem(_fromUtf8(""))
self.PlotTypeSelector.addItem(_fromUtf8(""))
self.PlotTypeSelector.addItem(_fromUtf8(""))
#self.horizontalLayout.addWidget(self.PlotTypeSelector)
self.PlotTypeSelector.setItemText(0, _translate("Form", "Select X", None))
self.PlotTypeSelector.setItemText(1, _translate("Form", "Select Y", None))
self.PlotTypeSelector.setItemText(2, _translate("Form", "Select Z", None))
self.PlotTypeSelector.setItemText(3, _translate("Form", "Line Plot", None))
self.PlotTypeLayout = QtGui.QVBoxLayout()
self.PlotTypeLayout.addWidget(self.PlotTypeSelector)
# add a empty label to move the PlotTypeSelector to the top
emptyL = QtGui.QLabel(Form)
self.PlotTypeLayout.addWidget(emptyL)
self.horizontalLayout.addLayout(self.PlotTypeLayout,stretch = -10)
self._addTraceSelectorIndicator(Form,sizePolicy,TraceSelector = "TraceXSelector",
TraceIndicator="TraceXValue", prefix = self.selector_labels[0]+': ')
self._addTraceSelectorIndicator(Form,sizePolicy,TraceSelector = "TraceYSelector",
TraceIndicator="TraceYValue", prefix = self.selector_labels[1]+': ')
self._addTraceSelectorIndicator(Form,sizePolicy,TraceSelector = "TraceZSelector",
TraceIndicator="TraceZValue", prefix = self.selector_labels[2]+': ')
spacerItem = QtGui.QSpacerItem(40, 1, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self._addIndicatorLabels(Form,sizePolicy,indicators=["PointX","PointY","PointZ"])