Beispiel #1
0
    def set_posicion(self, punto=(0, 0)):
        pos = punto
        x, y = pos
        w, h = (0, 0)
        for fila in self.matriz_letras:
            for letra in fila:
                letra.set_posicion((x, y))
                w, h = letra.get_tamanio()
                x += w
            y += h
            x = pos[0]

        # Verticales
        flecha = self.flechas['CHALECO']
        elemento = self.matriz_letras[0][0]
        ((a, b), (c, d)) = (elemento.get_posicion(), flecha.get_tamanio())
        flecha.set_posicion((a, b - d))
        flecha = self.flechas['MATE']
        elemento = self.matriz_letras[4][5]
        ((a, b), (c, d)) = (elemento.get_posicion(), flecha.get_tamanio())
        flecha.set_posicion((a, b - d))
        flecha = self.flechas['SRI']
        elemento = self.matriz_letras[4][7]
        ((a, b), (c, d)) = (elemento.get_posicion(), flecha.get_tamanio())
        flecha.set_posicion((a, b - d))
        flecha = self.flechas['BOCINA']
        elemento = self.matriz_letras[2][9]
        ((a, b), (c, d)) = (elemento.get_posicion(), flecha.get_tamanio())
        flecha.set_posicion((a, b - d))
        # Horizontales
        flecha = self.flechas['CELULAR']
        elemento = self.matriz_letras[0][0]
        ((a, b), (c, d)) = (elemento.get_posicion(), flecha.get_tamanio())
        flecha.set_posicion((a - c, b))
        flecha = self.flechas['ATRAS']
        elemento = self.matriz_letras[2][0]
        ((a, b), (c, d)) = (elemento.get_posicion(), flecha.get_tamanio())
        flecha.set_posicion((a - c, b))
        flecha = self.flechas['CODERA']
        elemento = self.matriz_letras[5][0]
        ((a, b), (c, d)) = (elemento.get_posicion(), flecha.get_tamanio())
        flecha.set_posicion((a - c, b))
        flecha = self.flechas['MUSICA']
        elemento = self.matriz_letras[4][5]
        ((a, b), (c, d)) = (elemento.get_posicion(), flecha.get_tamanio())
        flecha.set_posicion((a - c, b))

        ultimo = self.matriz_letras[-1][-1]
        x, y = ultimo.get_posicion()
        w, h = ultimo.get_tamanio()
        posbuttons = (x + w, y + h)

        for fila in self.matriz_letras:
            for letra in fila:
                if not letra.letra:
                    fila.remove(letra)
                    letra.kill()
        y = posbuttons[1] + 50
        for boton in self.botones[4:]:
            w, h = boton.get_tamanio()
            x = posbuttons[0] - w
            boton.set_posicion((x, y))
            y += h + 10
        y = posbuttons[1] + 50
        posbuttons = (posbuttons[0] - (w + 10), posbuttons[1])
        for boton in self.botones[:4]:
            w, h = boton.get_tamanio()
            x = posbuttons[0] - w
            boton.set_posicion((x, y))
            y += h + 10

        x, y = (G.RESOLUCION[0] / 2 + 115, 135)
        for label in self.textos:
            label.set_posicion((x, y))
            y += label.get_tamanio()[1] + 10

        a, b, c, d = (0, 0, 0, 0)
        a, b = self.textos[0].get_posicion()
        for label in self.textos:
            e, f = label.get_tamanio()
            if e > c: c = e
            if f > d: d = f
        sombra = JAMG.get_Sombra(
            (c + 40, self.textos[-1].get_posicion()[1] - b + d + 40),
            (92, 193, 235, 255), 80)
        sombra = sombra.sprites()[0]
        sombra.rect.x, sombra.rect.y = (a - 20, b - 20)
        self.add(sombra)
        for label in self.textos:
            self.add(label)
	def set_posicion(self, punto = (0,0)):
		pos = punto
		x, y = pos
		w, h = (0,0)
		for fila in self.matriz_letras:
			for letra in fila:
				letra.set_posicion( (x,y) )
				w,h = letra.get_tamanio()
				x += w
			y += h
			x = pos[0]

		# Verticales
		flecha = self.flechas['ACERA']
		elemento = self.matriz_letras[0][-1]
		((a,b), (c,d)) = (elemento.get_posicion(), flecha.get_tamanio())
		flecha.set_posicion( (a,b-d) )
		flecha = self.flechas['BANQUINA']
		elemento = self.matriz_letras[2][8]
		((a,b), (c,d)) = (elemento.get_posicion(), flecha.get_tamanio())
		flecha.set_posicion( (a,b-d) )
		flecha = self.flechas['CRUZAR']
		elemento = self.matriz_letras[2][6]
		((a,b), (c,d)) = (elemento.get_posicion(), flecha.get_tamanio())
		flecha.set_posicion( (a,b-d) )

		# Horizontales
		flecha = self.flechas['FILA']
		elemento = self.matriz_letras[0][9]
		((a,b), (c,d)) = (elemento.get_posicion(), flecha.get_tamanio())
		flecha.set_posicion( (a - c, b) )
		flecha = self.flechas['BORDE']
		elemento = self.matriz_letras[2][8]
		((a,b), (c,d)) = (elemento.get_posicion(), flecha.get_tamanio())
		flecha.set_posicion( (a-c,b) )
		flecha = self.flechas['ESQUINA']
		elemento = self.matriz_letras[4][3]
		((a,b), (c,d)) = (elemento.get_posicion(), flecha.get_tamanio())
		flecha.set_posicion( (a-c,b) )
		flecha = self.flechas['OPUESTA']
		elemento = self.matriz_letras[6][0]
		((a,b), (c,d)) = (elemento.get_posicion(), flecha.get_tamanio())
		flecha.set_posicion( (a-c,b) )
		flecha = self.flechas['PEATON']
		elemento = self.matriz_letras[-1][6]
		((a,b), (c,d)) = (elemento.get_posicion(), flecha.get_tamanio())
		flecha.set_posicion( (a-c,b) )

		ultimo = self.matriz_letras[-1][-1]
		x, y = ultimo.get_posicion()
		w, h = ultimo.get_tamanio()
		posbuttons = (x+w,y+h)

		for fila in self.matriz_letras:
			for letra in fila:
				if not letra.letra:
					fila.remove(letra)
					letra.kill()

		y = posbuttons[1] + 60
		for boton in self.botones[6:]:
			w,h = boton.get_tamanio()
			x = posbuttons[0] - w
			boton.set_posicion( (x, y) )
			y += h + 10
		y = posbuttons[1] + 60
		posbuttons = (posbuttons[0] - (w+10), posbuttons[1])
		for boton in self.botones[4:6]:
			w,h = boton.get_tamanio()
			x = posbuttons[0] - w
			boton.set_posicion( (x, y) )
			y += h + 10
		y = posbuttons[1] + 60
		posbuttons = (posbuttons[0] - (w+10), posbuttons[1])
		for boton in self.botones[2:4]:
			w,h = boton.get_tamanio()
			x = posbuttons[0] - w
			boton.set_posicion( (x, y) )
			y += h + 10
		y = posbuttons[1] + 60
		posbuttons = (posbuttons[0] - (w+10), posbuttons[1])
		for boton in self.botones[:2]:
			w,h = boton.get_tamanio()
			x = posbuttons[0] - w
			boton.set_posicion( (x, y) )
			y += h + 10

		x, y = (G.RESOLUCION[0]/2 + 175, 150)
		for label in self.textos:
			label.set_posicion((x,y))
			y += label.get_tamanio()[1]+10

		a,b,c,d = (0,0,0,0)
		a,b = self.textos[0].get_posicion()
		for label in self.textos:
			e,f = label.get_tamanio()
			if e > c: c = e
			if f > d: d = f
		sombra = JAMG.get_Sombra((c+40, self.textos[-1].get_posicion()[1]-b + d + 40),
			(92,193,235,255), 80)
		sombra = sombra.sprites()[0]
		sombra.rect.x, sombra.rect.y = (a-20, b-20)
		self.add(sombra)
		for label in self.textos:
			self.add(label)