本文整理汇总了Python中PyQt5.QtGui.QComboBox方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QComboBox方法的具体用法?Python QtGui.QComboBox怎么用?Python QtGui.QComboBox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtGui
的用法示例。
在下文中一共展示了QtGui.QComboBox方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QComboBox [as 别名]
def __init__(self, parent=None):
super().__init__(parent)
self.setTitle('Strategy')
self.setAlignment(QtCore.Qt.AlignCenter)
self.layout = QtGui.QHBoxLayout(self)
self.layout.setContentsMargins(0, 0, 0, 0)
self.list = QtGui.QComboBox()
self.add_btn = QtGui.QPushButton('+')
self.add_btn.clicked.connect(self.add_strategies)
self.start_btn = QtGui.QPushButton('Start Backtest')
self.start_btn.clicked.connect(self.load_strategy)
self.layout.addWidget(self.list, stretch=2)
self.layout.addWidget(self.add_btn, stretch=0)
self.layout.addWidget(self.start_btn, stretch=0)
self.load_strategies_from_settings()
示例2: get_QComboBox
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QComboBox [as 别名]
def get_QComboBox():
"""QComboBox getter."""
try:
import PySide.QtGui as QtGui
return QtGui.QComboBox
except ImportError:
import PyQt5.QtWidgets as QtWidgets
return QtWidgets.QComboBox
示例3: setupVector
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QComboBox [as 别名]
def setupVector(self,Form):
"""Set up slots for value_vector.
It is possible to plot the data over the x_axis and display the numeric
values 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.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.horizontalLayout.addWidget(self.PlotTypeSelector)
self.PlotTypeSelector.setItemText(0, _translate("Form", "Line Plot", None))
self.PlotTypeSelector.setItemText(1, _translate("Form", "Table", None))
spacerItem = QtGui.QSpacerItem(40, 1, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self._addIndicatorLabels(Form,sizePolicy,indicators=["PointX","PointY"])
示例4: init_shares_tab_ui
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QComboBox [as 别名]
def init_shares_tab_ui(self):
"""Shares."""
self.shares_tab = QtGui.QWidget()
self.shares_layout = QtGui.QFormLayout(self.shares_tab)
today = datetime.today()
self.shares_date_from = QtGui.QDateEdit()
self.shares_date_from.setMinimumDate(QtCore.QDate(1900, 1, 1))
self.shares_date_from.setMaximumDate(QtCore.QDate(2030, 12, 31))
self.shares_date_from.setDate(QtCore.QDate(today.year, 1, 1))
self.shares_date_from.setDisplayFormat('dd.MM.yyyy')
self.shares_date_to = QtGui.QDateEdit()
self.shares_date_to.setMinimumDate(QtCore.QDate(1900, 1, 1))
self.shares_date_to.setMaximumDate(QtCore.QDate(2030, 12, 31))
self.shares_date_to.setDate(
QtCore.QDate(today.year, today.month, today.day)
)
self.shares_date_to.setDisplayFormat('dd.MM.yyyy')
self.shares_symbol_list = QtGui.QComboBox()
self.shares_symbol_list.setFocusPolicy(QtCore.Qt.StrongFocus)
self.shares_symbol_list.setMaxVisibleItems(20)
self.shares_symbol_list.setEditable(True)
self.shares_show_btn = QtGui.QPushButton('Load')
self.shares_show_btn.clicked.connect(self.update_data)
self.shares_layout.addRow('From', self.shares_date_from)
self.shares_layout.addRow('To', self.shares_date_to)
self.shares_layout.addRow('Symbol', self.shares_symbol_list)
self.shares_layout.addRow(None, self.shares_show_btn)
self.select_source.addTab(self.shares_tab, 'Shares/Futures/ETFs')
示例5: rellenarTabla
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QComboBox [as 别名]
def rellenarTabla(self):
self.TablaAccesorios.verticalHeader().hide()
self.TablaAccesorios.setRowCount(0)
self.TablaAccesorios.setColumnCount(5)
titles = self.titles[:]
del titles[4]
self.TablaAccesorios.setHorizontalHeaderLabels(titles)
self.ListaAccesorios = []
self.diametros = []
self.pulgadas = []
self.k = []
self.comboxPulgadas = []
self.comboxmm = []
for i, Di, key, Di_in, K in FITTING:
if key in self.ListaAccesorios:
indice = self.ListaAccesorios.index(key)
self.diametros[indice].append(Di)
self.pulgadas[indice].append(Di_in)
self.k[indice].append(K)
self.comboxPulgadas[indice].addItem(Di_in)
self.comboxmm[indice].addItem(str(int(Di)))
else:
indice = self.TablaAccesorios.rowCount()
self.ListaAccesorios.append(key)
self.diametros.append([Di])
self.pulgadas.append([Di_in])
self.k.append([K])
self.TablaAccesorios.setRowCount(indice+1)
icon = os.environ["pychemqt"]+"images/equip/%s.png" % key
self.TablaAccesorios.setItem(
indice, 0, QtWidgets.QTableWidgetItem(QtGui.QIcon(
QtGui.QPixmap(icon)), key))
self.comboxmm.append(QtWidgets.QComboBox())
self.TablaAccesorios.setCellWidget(indice, 1, self.comboxmm[-1])
self.comboxmm[-1].addItem(str(int(Di)))
self.comboxmm[-1].currentIndexChanged.connect(self.combommChanged)
self.comboxPulgadas.append(QtWidgets.QComboBox())
self.TablaAccesorios.setCellWidget(
indice, 2, self.comboxPulgadas[-1])
self.comboxPulgadas[-1].addItem(Di_in)
self.comboxPulgadas[-1].currentIndexChanged.connect(
self.comboinchChanged)
self.TablaAccesorios.setItem(
indice, 3, QtWidgets.QTableWidgetItem("%0.3f" % K))
self.TablaAccesorios.item(indice, 3).setTextAlignment(
QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
self.TablaAccesorios.setItem(
indice, 4, QtWidgets.QTableWidgetItem(FITTING_DESC[key]))
self.TablaAccesorios.setRowHeight(
self.TablaAccesorios.rowCount()-1, 20)
self.TablaAccesorios.resizeColumnToContents(0)
self.TablaAccesorios.setColumnWidth(1, 60)
self.TablaAccesorios.setColumnWidth(2, 60)
self.TablaAccesorios.setColumnWidth(3, 50)
示例6: setupMatrix
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QComboBox [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"])
示例7: setupBox
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QComboBox [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"])