Salut à tout les programmeurs
J'ai décider d'apprendre a programmer en PyQT, et j'aimerai faire un truc sympa

Je voudrai enregistré les valeurs présents dans mes Spinbox, lorsque je choisie des éléments dans un ComboBox.

Exemple : Spinbox1 = 4 et Spinbox2 = 5

Si ComboBox1 = A et ComboBox2 = B
Alors stocker valeur Spinbox1 et Spinbox2 dans un tableau de donnée : Tab = [4, 5]
Et faire un print du tableau de donnée

Exemple2 : Spinbox1 = 2 et Spinbox2 = 8

Si ComboBox1 = B et ComboBox2 = D
Alors stocker valeur Spinbox1 et Spinbox2 dans un tableau de donnée : Tab = [2, 8]
Et faire un print du tableau de donnée

Remarque : Les valeurs dans les Spinbox son choisit dans l'interface graphique

Voici mon code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
 
import sys
import time
import serial
import binascii
 
from PyQt4 import QtCore, QtGui
 
class jouer(QtGui.QMainWindow):
    def __init__(self):
 
        # Main Window #
        QtGui.QMainWindow.__init__(self)
        self.resize(310,310)
        self.setWindowTitle(' debutant ')
 
        self.ComboBox_0 = QtGui.QComboBox()
        self.ComboBox_0.setGeometry(QtCore.QRect(10,10,10,10))
        self.ComboBox_0.addItem("A")
        self.ComboBox_0.addItem("B")
 
        self.ComboBox_1 = QtGui.QComboBox()
        self.ComboBox_1.setGeometry(QtCore.QRect(10,10,10,10))
        self.ComboBox_1.addItem("C")
        self.ComboBox_1.addItem("D")
 
        ''' SpinBox 1 '''         
        self.SpinBox_1 = QtGui.QSpinBox(self)
        self.SpinBox_1.setRange(-12,12)
        self.SpinBox_1.setSingleStep(1)
        self.SpinBox_1.setValue(0)
 
        ''' SpinBox 2 '''         
        self.SpinBox_2 = QtGui.QSpinBox(self)
        self.SpinBox_2.setRange(-12,12)
        self.SpinBox_2.setSingleStep(1)
        self.SpinBox_2.setValue(0)
 
 
 
        self.GridLayout_1 = QtGui.QGridLayout()
        self.GridLayout_1.addWidget(self.ComboBox_0,     1,0,1,1)
        self.GridLayout_1.addWidget(self.ComboBox_1,     2,0,1,1)
        self.GridLayout_1.addWidget(self.SpinBox_1,     1,1,1,1)
        self.GridLayout_1.addWidget(self.SpinBox_2,     2,1,1,1)
 
        ''' Group Box '''
        self.O_GroupBox_1 = QtGui.QGroupBox()
        self.O_GroupBox_1.setLayout(self.GridLayout_1)
        ''' Main Window - Central Widget '''
        self.setCentralWidget(self.O_GroupBox_1)
 
 
def main():
        '''Application'''
        App = QtGui.QApplication(sys.argv)
        App.setStyle("windows")
        MainWin2 = jouer()
        MainWin2.show()
        sys.exit(App.exec_() )
 
if __name__=='__main__':
    main()
Merci d'avance