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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
|
#!/usr/bin/env python
#-*- coding: cp1252 -*-
import sys
from PyQt4 import QtCore, QtGui
class part_3(QtGui.QMainWindow):
def __init__(self):
# Main Window #
QtGui.QMainWindow.__init__(self)
self.resize(210,110)
self.setWindowTitle(' Projet ')
self.ComboBox_0 = QtGui.QComboBox()
self.ComboBox_0.setGeometry(QtCore.QRect(10,10,10,10))
self.ComboBox_0.addItem("Choix_A")
self.ComboBox_0.addItem("Choix_B")
self.ComboBox_1 = QtGui.QComboBox()
self.ComboBox_1.setGeometry(QtCore.QRect(10,10,10,10))
self.ComboBox_1.addItem("Choix_1")
self.ComboBox_1.addItem("Choix_2")
VBoxLayout_1 = QtGui.QVBoxLayout()
VBoxLayout_1.addWidget(self.ComboBox_0)
VBoxLayout_1.addWidget(self.ComboBox_1)
VBoxLayout_1.setSpacing(100)
Widget_1 = QtGui.QWidget()
Widget_1.setLayout(VBoxLayout_1)
Dock_Gauche = QtGui.QDockWidget()
Dock_Gauche.setWidget(Widget_1)
self.addDockWidget(QtCore.Qt.LeftDockWidgetArea, Dock_Gauche)
self.SpinBox_1 = QtGui.QSpinBox(self)
self.SpinBox_1.setRange(-12,12)
self.SpinBox_1.setSingleStep(1)
self.SpinBox_1.setValue(0)
self.SpinBox_2 = QtGui.QSpinBox(self)
self.SpinBox_2.setRange(-12,12)
self.SpinBox_2.setSingleStep(1)
self.SpinBox_2.setValue(0)
self.SpinBox_3 = QtGui.QSpinBox(self)
self.SpinBox_3.setRange(-12,12)
self.SpinBox_3.setSingleStep(1)
self.SpinBox_3.setValue(0)
self.SpinBox_4 = QtGui.QSpinBox(self)
self.SpinBox_4.setRange(-12,12)
self.SpinBox_4.setSingleStep(1)
self.SpinBox_4.setValue(0)
self.GridLayout_1 = QtGui.QGridLayout()
self.GridLayout_1.addWidget(self.SpinBox_1, 1,0,1,1)
self.GridLayout_1.addWidget(self.SpinBox_2, 2,0,1,1)
self.GridLayout_1.addWidget(self.SpinBox_3, 1,1,1,1)
self.GridLayout_1.addWidget(self.SpinBox_4, 2,1,1,1)
''' Group Box '''
self.GroupBox_1 = QtGui.QGroupBox()
self.GroupBox_1.setLayout(self.GridLayout_1)
''' Main Window - Central Widget '''
self.setCentralWidget(self.GroupBox_1)
#-----------------------------
self.connect(self.SpinBox_1, QtCore.SIGNAL('valueChanged(int)'),self.M_UpdateBloc_1)
self.connect(self.SpinBox_2, QtCore.SIGNAL('valueChanged(int)'),self.M_UpdateBloc_1)
self.connect(self.SpinBox_3, QtCore.SIGNAL('valueChanged(int)'),self.M_UpdateBloc_1)
self.connect(self.SpinBox_4, QtCore.SIGNAL('valueChanged(int)'),self.M_UpdateBloc_1)
def M_UpdateBloc_1(self):
a = self.SpinBox_1.value()
b = self.SpinBox_2.value()
c = self.SpinBox_3.value()
d = self.SpinBox_4.value()
Tab_1 = [a, b, c, d]
if str(self.ComboBox_0.currentText()) == "Choix_A" :
if str(self.ComboBox_1.currentText()) == "Choix_1" :
Tab_1 = [a, b, c, d]
print "Voici le tableau de HANDSET et VOICE pour AGC : "
print Tab_1
#-----------------------------
def main():
'''Application'''
App = QtGui.QApplication(sys.argv)
App.setStyle("windows")
MainWin2 = part_3()
MainWin2.show()
sys.exit(App.exec_() )
if __name__=='__main__':
main() |
Partager