當前位置: 首頁>>代碼示例>>Python>>正文


Python QtGui.QComboBox方法代碼示例

本文整理匯總了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() 
開發者ID:constverum,項目名稱:Quantdom,代碼行數:22,代碼來源:ui.py

示例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 
開發者ID:AirbusCyber,項目名稱:grap,代碼行數:11,代碼來源:QtShim.py

示例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"]) 
開發者ID:qkitgroup,項目名稱:qkit,代碼行數:30,代碼來源:plot_view.py

示例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') 
開發者ID:constverum,項目名稱:Quantdom,代碼行數:36,代碼來源:ui.py

示例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) 
開發者ID:jjgomera,項目名稱:pychemqt,代碼行數:58,代碼來源:UI_pipe.py

示例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"]) 
開發者ID:qkitgroup,項目名稱:qkit,代碼行數:50,代碼來源:plot_view.py

示例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"]) 
開發者ID:qkitgroup,項目名稱:qkit,代碼行數:52,代碼來源:plot_view.py


注:本文中的PyQt5.QtGui.QComboBox方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。