예제 #1
0
    def celdaClicked(self):
        """Selecciona el casillero al que se le quiere asignar un valor,
            obteniendo sus respectivos atributos"""
        if (not (self.celdaSeleccionada)):
            self.celdaSeleccionada = True
        else:
            celda = self.casilla[self.coorX][self.coorY]
            
            if(celda.getColor == 0):
                celda.setStyleSheet('QPushButton {background-color: SteelBlue; color: Brown; font:bold}')
            else:
                celda.setStyleSheet('QPushButton {background-color: LightPink; color: Brown; font:bold}')

        celda = numero()
        celda = self.sender() 
        self.coorX = celda.getFila()
        self.coorY = celda.getColumna()
        if (celda.getNumReal() == celda.getNumeroAsignado()):
            self.ui.radioButton.setChecked(True)
        else:
            self.ui.radioButton.setChecked(False)
        
        for i in range(9):
            numSelec = self.valorPad[i] 
            numSelec.setEnabled(True)
        if(self.ui.hintButton.isChecked()):
            self.validarCelda()
            
        celda.setStyleSheet('QPushButton {background-color: orange; font:bold}')
예제 #2
0
 def iniciarArreglo (self):
     """Crea e inicializa la matriz self.casilla de clase numero()"""
     del self.casilla [:]
     for i in range (9):
         self.casilla.append ([])
         for j in range(9):
             celda = numero()
             self.casilla[i]. append ([])
             celda = numero()
             celda.setFila(i)
             celda.setColumna(j)
             celda.setNumReal(0)
             celda.setNumeroAsignado(0)
             celda.setColor(0)
             celda.setEsConstante(False)
             self.casilla [i][j] = celda
 def celdaClicked(self):
     if(not(celdaSeleccionada)):
         celdaSeleccionada = True
     else:
         celda = casilla[coorX][coorY]
         if(celda.getColor == 0):
             celda.setStyleSheet('QPushButton {background-color: red}')
         else:
             celda.setStyleSheet('QPushButton {background-color: blue}')
     celda = numero()
     celda.sender()
     coorX = celda.getFila()
     coorY = celda.getColumna()
     
     if (celda.getNumReal() == celda.getNumeroAsignado()):
         self.ui.bnormal.setChecked(True)
     else:
         self.ui.bnormal.setChecked(False)
         numSelec = QPushButton() 
     for i in range(0,9):
         numSelec = valorPad[i] 
         numSelec.setEnabled(True)
     if(self.ui.bnormal.isChecked()):
         self.validarCelda()
     
     celda.setStyleSheet('QPushButton {background-color: orange}')
    def initGui(self):
        
        global coorX
        global coorY
        global encriptar
        global celdaSeleccionada
        global casilla
        global valorPad
        casilla = [[0 for j in range(9)] for i in range(9)]
        valorPad = [0 for j in range(9)]
        coorX = -1
        coorY = -1
        
        flag = False
                  
        for i in range(0,9):    
            for j in range(0,9):
               celda = numero()
               celda.setFila(i)
               celda.setColumna(j)
               celda.setNumReal(0)
               celda.setNumAsignado(0)
               celda.setEsConstante(False)
               
               if(flag):
                   celda.setColor(0)
                   celda.setStyleSheet('QPushButton {background-color: red}' )
               else:
                   celda.setColor(1)
                   celda.setStyleSheet('QPushButton {background-color: blue}' )
               casilla [i][j]= celda
               self.ui.taberosudoku.addWidget(celda,i,j)
               
               if(j % 3 == 2):
                    flag = not(flag)
            if(i % 3 != 2):
                flag = not (flag)
                  
        for i in range(0,9):
            numSelec = QPushButton(str(i+1))
            valorPad [i] = numSelec
            self.ui.tableronumeros.addWidget(numSelec,i/3, i%3)
            numSelec.setStyleSheet('QPushButton {background-color: black; color: white}')
    
        self.ui.blimpiar.setText('Borrar')
        self.ui.blimpiar.setEnabled(False)
        #self.ui.nullButton.setStyleSheet('QPushButton {background-color: black; color: white}')
        celdaSeleccionada = False
        self.ventanaInvalida()
        
        
        self.lcd = QtGui.QLCDNumber(self)
        self.lcd.setDigitCount(8)          # change the number of digits displayed
        #posicion=self.ui.lcdNumber.setDigitCount(8)
        #self.setGeometry(30, 30, 800, 600)
        #self.setWindowTitle('Time')

        #vbox = QtGui.QVBoxLayout()
        #vbox.addWidget(self.lcd)
        self.ui.seccioncronometro.addWidget(self.lcd)
 def initGui(self):        
     global coorX
     global coorY
     global encriptar
     global celdaSeleccionada
     global casilla
     global valorPad
     
     casilla = [[0 for j in range(9)] for i in range(9)]
     valorPad = [0 for j in range(9)]
     coorX = -1
     coorY = -1
     
     flag = False
               
     for i in range(0,9):    
         for j in range(0,9):
            celda = numero()
            celda.setFila(i)
            celda.setColumna(j)
            celda.setNumReal(0)
            celda.setNumAsignado(0)
            celda.setEsConstante(False)
            
            if(flag):
                celda.setColor(0)
                celda.setStyleSheet('QPushButton {background-color: red}' )
            else:
                celda.setColor(1)
                celda.setStyleSheet('QPushButton {background-color: blue}' )
            casilla [i][j]= celda
            self.ui.taberosudoku.addWidget(celda,i,j)
            
            if(j % 3 == 2):
                 flag = not(flag)
         if(i % 3 != 2):
             flag = not (flag)
               
     for i in range(0,9):
         numSelec = QPushButton(str(i+1))
         valorPad [i] = numSelec
         self.ui.tableronumeros.addWidget(numSelec,i/3, i%3)
         numSelec.setStyleSheet('QPushButton {background-color: black; color: white}')
 
     self.ui.blimpiar.setText('Borrar')
     self.ui.blimpiar.setEnabled(False)
     celdaSeleccionada = False
     self.ventanaInvalida()
 def validarCelda(self):
     centerX = coorX/3
     centerY = coorY/3
     celda = numero()
     for i in range(0,9):
         for j in range(0,9):
             if(i == coorX | j == coorY | (i/3 == centerX & j/3 == centerY )):
                 celda = casilla[i][j]
                 if (celda.getNumeroAsignado()):
                     numSelec = QPushButton()
                     valor = celda.getNumeroAsignado()
                     numSelec = valorPad[valor -1]
                     numSelec.setEnabled(False)
     
     celda = casilla[coorX][coorY]
     if(not(celda.getNumeroAsignado())):
         self.ui.blimpiar.setEnabled(False)
     else:
         self.ui.blimpiar.setEnabled(True)
 def ventanaInvalida(self):
     coorX = -1
     coorY = -1
     celda = numero()
     for i in range(0,9):
         for j in range(0,9):
             celda = casilla[i][j]
             celda.setEnabled(False)
             if(celda.getColor() == 0):
                 celda.setStyleSheet('QPushButton {background-color: red}')
             else:
                 celda.setStyleSheet('QPushButton {background-color: blue}')
         numSelec = QPushButton()
         numSelec = valorPad[i]
         numSelec.setEnabled(False)
     
     self.ui.blimpiar.setEnabled(False)
     self.ui.bnormal.setChecked(False)
     self.celdaSeleccionada = False
     
     self.ui.groupBox_2.setEnabled(False)        
예제 #8
0
파일: vocab.py 프로젝트: n0obwd/French
     learn(pTense, int(args['word']), chooseWord(filename,
                                                 int(args['word'])))
     print "*********************"
 else:
     if args['task'] == "a":
         finalScore = random_games(pTense, int(args['word']),
                                   chooseWord(filename, int(args['word'])))
     if args['task'] == "b":
         finalScore = reverse(pTense, int(args['word']),
                              chooseWord(filename, int(args['word'])))
     if args['task'] == "c":
         finalScore = instant(pTense, int(args['word']),
                              chooseWord(filename, int(args['word'])))
     if args['task'] == "d":
         filename = "numero.lib"
         finalScore = numero(int(args['word']))
     if args['task'] == "e":
         finalScore = numero_10(int(args['word']))
     if args['task'] == "f":
         finalScore = nation(int(args['word']))
     if args['task'] == "conjugation1":
         finalScore = verbConj1(int(args['word']),
                                chooseWord(filename, int(args['word'])))
     if args['task'] == "conjugation2":
         finalScore = verbConj2(int(args['word']),
                                chooseWord(filename, int(args['word'])))
     if args['task'] == "q":
         finalScore = quizlet(int(args['word']))
     print "*********************"
     print "Final score: %d/%d" % (finalScore, int(args['word']))
     if finalScore < int(args['word']):