コード例 #1
0
	def __init__(self, main):
		pygame.sprite.OrderedUpdates.__init__(self)
		self.main = main
		imagen = G.get_Flecha()

		salir = JAMButton("",None)
		salir.set_imagen(origen = imagen, tamanio=(100,55))
		salir.set_colores(colorbas =JAMG.get_negro(), colorcara=JAMG.get_negro())
		salir.set_tamanios(tamanio =(0,0), grosorbor=1, detalle=1, espesor=1)
		salir.set_posicion(punto = (10,10))
		#salir.connect (callback = self.main.run_dialog_intro)
		salir.connect (callback = self.main.salir, sonido_select = None)
		self.add(salir)

		jugar = JAMButton("Jugar",None)
		jugar.set_text(color=JAMG.get_blanco())
		fuente, tamanio = JAMG.get_Font_fawn()
		jugar.set_font_from_file(fuente, tamanio= 50)
		jugar.set_colores(colorbas=JAMG.get_negro(), colorcara=JAMG.get_negro())
		jugar.set_tamanios(tamanio=(200,0), grosorbor=1, detalle=1, espesor=1)
		w,h = G.RESOLUCION
		ww,hh = jugar.get_tamanio()
		jugar.set_posicion(punto= (w-ww-10,h-hh-10))
		jugar.connect (callback= self.run_Instruc)
		self.add(jugar)
コード例 #2
0
 def __init__(self, main):
     pygame.sprite.OrderedUpdates.__init__(self)
     self.main = main
     self.imagenes = G.get_Presentacion()
     self.siguiente = None
     self.anterior = None
     salir = None
     self.imagen_actual = None
     self.estado = True
     fuente, tamanio = JAMG.get_Font_fawn()
     w, h = G.RESOLUCION
     self.siguiente = JAMButton("Siguiente", None)
     self.siguiente.set_text(color=JAMG.get_blanco())
     self.siguiente.set_font_from_file(fuente, tamanio=40)
     self.siguiente.set_colores(colorbas=JAMG.get_negro(),
                                colorcara=JAMG.get_negro())
     self.siguiente.set_tamanios(tamanio=(150, 0),
                                 grosorbor=1,
                                 detalle=1,
                                 espesor=1)
     ww, hh = self.siguiente.get_tamanio()
     self.siguiente.set_posicion(punto=(w - ww - 20, h - hh - 20))
     self.siguiente.connect(callback=self.next, sonido_select=None)
     self.add(self.siguiente)
     self.anterior = JAMButton("Anterior", None)
     self.anterior.set_text(color=JAMG.get_blanco())
     self.anterior.set_font_from_file(fuente, tamanio=40)
     self.anterior.set_colores(colorbas=JAMG.get_negro(),
                               colorcara=JAMG.get_negro())
     self.anterior.set_tamanios(tamanio=(150, 0),
                                grosorbor=1,
                                detalle=1,
                                espesor=1)
     ww, hh = self.anterior.get_tamanio()
     self.anterior.set_posicion(punto=(20, h - hh - 20))
     self.anterior.connect(callback=self.previous, sonido_select=None)
     self.add(self.anterior)
     salir = JAMButton("Salir", None)
     salir.set_text(color=JAMG.get_blanco())
     salir.set_font_from_file(fuente, tamanio=40)
     salir.set_colores(colorbas=JAMG.get_negro(),
                       colorcara=JAMG.get_negro())
     salir.set_tamanios(tamanio=(150, 0), grosorbor=1, detalle=1, espesor=1)
     ww, hh = salir.get_tamanio()
     salir.set_posicion(punto=(w / 2 - ww / 2, 20))
     salir.connect(callback=self.volver, sonido_select=None)
     self.add(salir)
     self.imagen_actual = self.imagenes[0]
     self.main.fondo = self.imagen_actual
コード例 #3
0
class Presentacion(pygame.sprite.OrderedUpdates):
    def __init__(self, main):
        pygame.sprite.OrderedUpdates.__init__(self)
        self.main = main
        self.imagenes = G.get_Presentacion()
        self.siguiente = None
        self.anterior = None
        salir = None
        self.imagen_actual = None
        self.estado = True
        fuente, tamanio = JAMG.get_Font_fawn()
        w, h = G.RESOLUCION
        self.siguiente = JAMButton("Siguiente", None)
        self.siguiente.set_text(color=JAMG.get_blanco())
        self.siguiente.set_font_from_file(fuente, tamanio=40)
        self.siguiente.set_colores(colorbas=JAMG.get_negro(),
                                   colorcara=JAMG.get_negro())
        self.siguiente.set_tamanios(tamanio=(150, 0),
                                    grosorbor=1,
                                    detalle=1,
                                    espesor=1)
        ww, hh = self.siguiente.get_tamanio()
        self.siguiente.set_posicion(punto=(w - ww - 20, h - hh - 20))
        self.siguiente.connect(callback=self.next, sonido_select=None)
        self.add(self.siguiente)
        self.anterior = JAMButton("Anterior", None)
        self.anterior.set_text(color=JAMG.get_blanco())
        self.anterior.set_font_from_file(fuente, tamanio=40)
        self.anterior.set_colores(colorbas=JAMG.get_negro(),
                                  colorcara=JAMG.get_negro())
        self.anterior.set_tamanios(tamanio=(150, 0),
                                   grosorbor=1,
                                   detalle=1,
                                   espesor=1)
        ww, hh = self.anterior.get_tamanio()
        self.anterior.set_posicion(punto=(20, h - hh - 20))
        self.anterior.connect(callback=self.previous, sonido_select=None)
        self.add(self.anterior)
        salir = JAMButton("Salir", None)
        salir.set_text(color=JAMG.get_blanco())
        salir.set_font_from_file(fuente, tamanio=40)
        salir.set_colores(colorbas=JAMG.get_negro(),
                          colorcara=JAMG.get_negro())
        salir.set_tamanios(tamanio=(150, 0), grosorbor=1, detalle=1, espesor=1)
        ww, hh = salir.get_tamanio()
        salir.set_posicion(punto=(w / 2 - ww / 2, 20))
        salir.connect(callback=self.volver, sonido_select=None)
        self.add(salir)
        self.imagen_actual = self.imagenes[0]
        self.main.fondo = self.imagen_actual

    def volver(self, button):
        for sprite in self.sprites():
            sprite.kill()
        self.empty()
        self.estado = False

    def next(self, button):
        indice = self.imagenes.index(self.imagen_actual)
        if indice < len(self.imagenes) - 1:
            indice += 1
            self.imagen_actual = self.imagenes[indice]
            self.main.fondo = self.imagen_actual
        self.main.ventana.blit(self.main.fondo, (0, 0))
        pygame.display.update()
        self.view_buttons(indice)

    def previous(self, button):
        indice = self.imagenes.index(self.imagen_actual)
        if indice > 0:
            indice -= 1
            self.imagen_actual = self.imagenes[indice]
            self.main.fondo = self.imagen_actual
        self.main.ventana.blit(self.main.fondo, (0, 0))
        pygame.display.update()
        self.view_buttons(indice)

    def view_buttons(self, indice):
        if indice == len(self.imagenes) - 1:
            self.remove(self.siguiente)
        elif indice == 0:
            self.remove(self.anterior)
        else:
            if not self.anterior in self.sprites():
                self.add(self.anterior)
            if not self.siguiente in self.sprites():
                self.add(self.siguiente)
コード例 #4
0
ファイル: Intro.py プロジェクト: cemeiq/Bichos
    def config(self):
        pygame.init()
        self.reloj = pygame.time.Clock()

        from pygame.locals import MOUSEMOTION
        from pygame.locals import MOUSEBUTTONUP
        from pygame.locals import MOUSEBUTTONDOWN
        from pygame.locals import JOYAXISMOTION
        from pygame.locals import JOYBALLMOTION
        from pygame.locals import JOYHATMOTION
        from pygame.locals import JOYBUTTONUP
        from pygame.locals import JOYBUTTONDOWN
        from pygame.locals import VIDEORESIZE
        from pygame.locals import VIDEOEXPOSE
        from pygame.locals import USEREVENT
        from pygame.locals import QUIT
        from pygame.locals import ACTIVEEVENT
        from pygame.locals import KEYDOWN
        from pygame.locals import KEYUP

        pygame.event.set_blocked([
            JOYAXISMOTION, JOYBALLMOTION, JOYHATMOTION, JOYBUTTONUP,
            JOYBUTTONDOWN, ACTIVEEVENT, USEREVENT
        ])
        pygame.event.set_allowed([
            QUIT, VIDEORESIZE, VIDEOEXPOSE, KEYDOWN, KEYUP, MOUSEMOTION,
            MOUSEBUTTONUP, MOUSEBUTTONDOWN
        ])
        pygame.key.set_repeat(15, 15)

        pygame.display.set_mode((0, 0), pygame.DOUBLEBUF | pygame.FULLSCREEN,
                                0)

        pygame.display.set_caption("Bichos")

        path = os.path.join(BASE_PATH, "CucaraSims", "Imagenes", "arena1.png")
        imagen = pygame.image.load(path)
        self.escenario = pygame.transform.scale(
            imagen, RESOLUCION_INICIAL).convert_alpha()

        self.ventana = pygame.Surface(
            (RESOLUCION_INICIAL[0], RESOLUCION_INICIAL[1]), flags=HWSURFACE)
        self.ventana_real = pygame.display.get_surface()

        boton = JAMButton("CucaraSims", None, "rectangulo")
        boton.set_text(tamanio=30)
        boton.set_tamanios(tamanio=(160, 70), grosorbor=3, espesor=5)
        boton.set_colores(colorbas=(51, 121, 183, 255),
                          colorbor=(255, 255, 255, 255),
                          colorcara=(206, 229, 237, 255))
        boton.connect(callback=self.__emit_go_cucarasims, sonido_select=None)
        x = (RESOLUCION_INICIAL[0] / 4 - (boton.get_tamanio()[0] / 2))
        y = 50
        boton.set_posicion(punto=(x, y))
        self.widgets.add(boton)

        boton = JAMButton("Canciones", None, "rectangulo")
        boton.set_text(tamanio=30)
        boton.set_tamanios(tamanio=(160, 70), grosorbor=3, espesor=5)
        boton.set_colores(colorbas=(51, 121, 183, 255),
                          colorbor=(255, 255, 255, 255),
                          colorcara=(206, 229, 237, 255))
        boton.connect(callback=self.__emit_go_cantores, sonido_select=None)
        x = (RESOLUCION_INICIAL[0] / 2 - (boton.get_tamanio()[0] / 2))
        y = 50
        boton.set_posicion(punto=(x, y))
        self.widgets.add(boton)

        boton = JAMButton("Imágenes", None, "rectangulo")
        boton.set_text(tamanio=30)
        boton.set_tamanios(tamanio=(160, 70), grosorbor=3, espesor=5)
        boton.set_colores(colorbas=(51, 121, 183, 255),
                          colorbor=(255, 255, 255, 255),
                          colorcara=(206, 229, 237, 255))
        boton.connect(callback=self.__emit_go_ojos, sonido_select=None)
        x = (RESOLUCION_INICIAL[0] / 4 * 3 - (boton.get_tamanio()[0] / 2))
        y = 50
        boton.set_posicion(punto=(x, y))
        self.widgets.add(boton)

        boton = JAMButton("Salir", None, "rectangulo")
        boton.set_text(tamanio=30)
        boton.set_tamanios(tamanio=(160, 70), grosorbor=3, espesor=5)
        boton.set_colores(colorbas=(51, 121, 183, 255),
                          colorbor=(255, 255, 255, 255),
                          colorcara=(206, 229, 237, 255))
        boton.connect(callback=self.__emit_exit, sonido_select=None)
        x = (RESOLUCION_INICIAL[0] / 4 * 3 - (boton.get_tamanio()[0] / 2))
        y = (RESOLUCION_INICIAL[1] - boton.get_tamanio()[1]) - 50
        boton.set_posicion(punto=(x, y))
        self.widgets.add(boton)

        path = os.path.join(BASE_PATH, "Iconos", "bichos.png")
        imagen = pygame.image.load(path)
        titulo = pygame.sprite.Sprite()
        titulo.image = imagen
        titulo.rect = titulo.image.get_rect()
        titulo.rect.centerx = RESOLUCION_INICIAL[0] / 2
        titulo.rect.centery = RESOLUCION_INICIAL[1] / 2
        self.widgets.add(titulo)
コード例 #5
0
class Selector(pygame.sprite.OrderedUpdates):
    def __init__(self, main):
        pygame.sprite.OrderedUpdates.__init__(self)
        fuente, tamanio = JAMG.get_Font_fawn()
        self.main = main
        self.posiciones_usuarios = (0, 0)
        imagen = os.path.join(G.IMAGENES, "Login", "fondo_selecciona.png")
        imagen = pygame.transform.scale(pygame.image.load(imagen), (427, 573))
        self.fondo = pygame.sprite.Sprite()
        self.fondo.image = (imagen)
        self.fondo.rect = self.fondo.image.get_rect()
        self.add(self.fondo)

        self.label = JAMLabel("Selecciona tu Usuario")
        self.label.set_font_from_file(fuente, tamanio=40)
        self.label.set_text(color=(255, 255, 255, 255))
        self.add(self.label)

        imagen = G.get_Flecha()
        salir = JAMButton("", None)
        salir.set_imagen(origen=imagen, tamanio=(100, 55))
        salir.set_colores(colorbas=JAMG.get_negro(),
                          colorcara=JAMG.get_negro())
        salir.set_tamanios(tamanio=(0, 0), grosorbor=1, detalle=1, espesor=1)
        salir.set_posicion(punto=(10, 10))
        salir.connect(callback=main.run_dialog_intro)
        self.add(salir)

        self.upper = BotonScroll()
        self.upper.set_imagen("up")
        self.upper.connect(callback=self.up_user, sonido_select=None)
        self.add(self.upper)

        self.down = BotonScroll()
        self.down.set_imagen("down")
        self.down.connect(callback=self.down_user, sonido_select=None)
        self.add(self.down)

        usuarios = G.get_users()
        self.usuarios = []
        for user in usuarios:
            usuario = Usuario(user)
            usuario.connect(callback=self.emit_load_usuario,
                            sonido_select=None)
            self.usuarios.append(usuario)

        self.usuariosenmenu = None
        if len(self.usuarios) <= 3:
            self.usuariosenmenu = self.usuarios
        else:
            self.usuariosenmenu = self.usuarios[:3]
        if self.usuariosenmenu: self.add(self.usuariosenmenu)

        self.crear = JAMButton("Crear Nuevo", None)
        self.crear.set_tamanios(grosorbor=1, detalle=1, espesor=1)
        self.crear.set_font_from_file(fuente, tamanio=25)
        self.crear.set_colores(colorbas=(0, 157, 224, 255),
                               colorbor=(0, 157, 224, 255),
                               colorcara=(92, 193, 235, 255))
        self.crear.set_text(color=(255, 255, 255, 255))
        self.crear.connect(callback=main.crear_usuario, sonido_select=None)
        self.add(self.crear)

    def up_user(self, button):
        if len(self.usuarios) <= 3:
            return
        else:
            indice = self.usuarios.index(self.usuariosenmenu[0])
            indice -= 1
            usuarios = [
                self.usuarios[indice], self.usuariosenmenu[0],
                self.usuariosenmenu[1]
            ]
            self.remove(self.usuariosenmenu)
            self.usuariosenmenu = usuarios
            self.set_posiciones_usuarios()
            self.add(self.usuariosenmenu)

    def down_user(self, button):
        if len(self.usuarios) <= 3:
            return
        else:
            indice = self.usuarios.index(self.usuariosenmenu[-1])
            if indice == len(self.usuarios) - 1:
                indice = 0
            else:
                indice += 1
            usuarios = [
                self.usuariosenmenu[1], self.usuariosenmenu[2],
                self.usuarios[indice]
            ]
            self.remove(self.usuariosenmenu)
            self.usuariosenmenu = usuarios
            self.set_posiciones_usuarios()
            self.add(self.usuariosenmenu)

    def center(self, fondo_size):
        sep = 10

        a, b = self.label.get_tamanio()
        self.label.set_posicion((fondo_size[0] / 2 - a / 2, sep * 2))
        x, y, fondow, fondoh = self.fondo.rect
        ww, hh = fondo_size
        x, y = (ww / 2 - fondow / 2, hh / 2 - fondoh / 2)
        self.fondo.rect.x, self.fondo.rect.y = (x, y)

        w, h = self.upper.get_tamanio()
        posx, posy = (x + (fondow / 2 - w / 2), y + sep)
        self.upper.set_posicion((posx, posy))

        w, h = self.down.get_tamanio()
        posx, posy = (x + (fondow / 2 - w / 2), y + fondoh - h - sep)
        self.down.set_posicion((posx, posy))

        # usuarios
        x, y = self.upper.get_posicion()
        w, h = self.upper.get_tamanio()
        xx, yy = self.down.get_posicion()
        espacio = (yy - sep) - (y + h + sep)
        altura = espacio / 3

        posy = y + h + sep
        self.posiciones_usuarios = (x, posy)
        for user in self.usuarios:
            user.set_tamanios(tamanio=(w, altura),
                              grosorbor=1,
                              detalle=1,
                              espesor=1)
            user.set_posicion((x, posy))
            posy += altura

        self.crear.set_tamanios(tamanio=(w, h),
                                grosorbor=1,
                                detalle=1,
                                espesor=1)
        x, y, ww, h = self.fondo.rect
        self.crear.set_posicion((fondo_size[0] / 2 - w / 2, y + h + sep * 2))

    def emit_load_usuario(self, widget):
        self.main.emit_load_usuario(widget.usuario)

    def set_posiciones_usuarios(self):
        x, posy = self.posiciones_usuarios
        for user in self.usuariosenmenu:
            user.set_posicion((x, posy))
            posy += user.get_tamanio()[1]
コード例 #6
0
ファイル: Intro.py プロジェクト: fdanesse/Bichos
    def config(self):
        pygame.init()
        self.reloj = pygame.time.Clock()

        from pygame.locals import MOUSEMOTION
        from pygame.locals import MOUSEBUTTONUP
        from pygame.locals import MOUSEBUTTONDOWN
        from pygame.locals import JOYAXISMOTION
        from pygame.locals import JOYBALLMOTION
        from pygame.locals import JOYHATMOTION
        from pygame.locals import JOYBUTTONUP
        from pygame.locals import JOYBUTTONDOWN
        from pygame.locals import VIDEORESIZE
        from pygame.locals import VIDEOEXPOSE
        from pygame.locals import USEREVENT
        from pygame.locals import QUIT
        from pygame.locals import ACTIVEEVENT
        from pygame.locals import KEYDOWN
        from pygame.locals import KEYUP

        pygame.event.set_blocked([
            JOYAXISMOTION, JOYBALLMOTION, JOYHATMOTION, JOYBUTTONUP,
            JOYBUTTONDOWN, ACTIVEEVENT, USEREVENT])
        pygame.event.set_allowed([QUIT, VIDEORESIZE, VIDEOEXPOSE,
            KEYDOWN, KEYUP, MOUSEMOTION, MOUSEBUTTONUP, MOUSEBUTTONDOWN])
        pygame.key.set_repeat(15, 15)

        pygame.display.set_mode(
            (0, 0), pygame.DOUBLEBUF | pygame.FULLSCREEN, 0)

        pygame.display.set_caption("Bichos")

        path = os.path.join(BASE_PATH, "CucaraSims", "Imagenes", "arena1.png")
        imagen = pygame.image.load(path)
        self.escenario = pygame.transform.scale(
            imagen, RESOLUCION_INICIAL).convert_alpha()

        self.ventana = pygame.Surface((RESOLUCION_INICIAL[0],
            RESOLUCION_INICIAL[1]), flags=HWSURFACE)
        self.ventana_real = pygame.display.get_surface()

        boton = JAMButton("CucaraSims", None, "rectangulo")
        boton.set_text(tamanio=30)
        boton.set_tamanios(tamanio=(160, 70), grosorbor=3, espesor=5)
        boton.set_colores(colorbas=(51, 121, 183, 255),
            colorbor=(255, 255, 255, 255), colorcara=(206, 229, 237, 255))
        boton.connect(callback=self.__emit_go_cucarasims, sonido_select=None)
        x = (RESOLUCION_INICIAL[0] / 4 - (boton.get_tamanio()[0] / 2))
        y = 50
        boton.set_posicion(punto=(x, y))
        self.widgets.add(boton)

        boton = JAMButton("Canciones", None, "rectangulo")
        boton.set_text(tamanio=30)
        boton.set_tamanios(tamanio=(160, 70), grosorbor=3, espesor=5)
        boton.set_colores(colorbas=(51, 121, 183, 255),
            colorbor=(255, 255, 255, 255), colorcara=(206, 229, 237, 255))
        boton.connect(callback=self.__emit_go_cantores, sonido_select=None)
        x = (RESOLUCION_INICIAL[0] / 2 - (boton.get_tamanio()[0] / 2))
        y = 50
        boton.set_posicion(punto=(x, y))
        self.widgets.add(boton)

        boton = JAMButton("Imágenes", None, "rectangulo")
        boton.set_text(tamanio=30)
        boton.set_tamanios(tamanio=(160, 70), grosorbor=3, espesor=5)
        boton.set_colores(colorbas=(51, 121, 183, 255),
            colorbor=(255, 255, 255, 255), colorcara=(206, 229, 237, 255))
        boton.connect(callback=self.__emit_go_ojos, sonido_select=None)
        x = (RESOLUCION_INICIAL[0] / 4 * 3 - (boton.get_tamanio()[0] / 2))
        y = 50
        boton.set_posicion(punto=(x, y))
        self.widgets.add(boton)

        boton = JAMButton("Salir", None, "rectangulo")
        boton.set_text(tamanio=30)
        boton.set_tamanios(tamanio=(160, 70), grosorbor=3, espesor=5)
        boton.set_colores(colorbas=(51, 121, 183, 255),
            colorbor=(255, 255, 255, 255), colorcara=(206, 229, 237, 255))
        boton.connect(callback=self.__emit_exit, sonido_select=None)
        x = (RESOLUCION_INICIAL[0] / 4 * 3 - (boton.get_tamanio()[0] / 2))
        y = (RESOLUCION_INICIAL[1] - boton.get_tamanio()[1]) - 50
        boton.set_posicion(punto=(x, y))
        self.widgets.add(boton)

        path = os.path.join(BASE_PATH, "Iconos", "bichos.png")
        imagen = pygame.image.load(path)
        titulo = pygame.sprite.Sprite()
        titulo.image = imagen
        titulo.rect = titulo.image.get_rect()
        titulo.rect.centerx = RESOLUCION_INICIAL[0] / 2
        titulo.rect.centery = RESOLUCION_INICIAL[1] / 2
        self.widgets.add(titulo)
コード例 #7
0
class Frame(pygame.sprite.OrderedUpdates):
    def __init__(self, main):
        pygame.sprite.OrderedUpdates.__init__(self)
        imagen = os.path.join(G.IMAGENES, "Login", "fondo_selecciona.png")
        imagen = pygame.transform.scale(pygame.image.load(imagen), (800, 570))
        fuente, tamanio = JAMG.get_Font_fawn()
        imagen_teclado = os.path.join(G.IMAGENES, "icono_teclado.jpg")

        self.main = main
        self.estado = None

        self.usuario = {
            'nombre': '',
            'edad': '',
            'escuela': '',
            'clase': '',
            'departamento': '',
            'personaje': ''
        }

        self.jacinto = BotonUsuario()
        imagenusuario = os.path.join(G.IMAGENES, "Login", "jacinto.png")
        self.jacinto.set_imagen(origen=imagenusuario)
        self.jacinto.connect(callback=self.select_personaje,
                             sonido_select=None)

        self.jose = BotonUsuario()
        imagenusuario = os.path.join(G.IMAGENES, "Login", "jose.png")
        self.jose.set_imagen(origen=imagenusuario)
        self.jose.connect(callback=self.select_personaje, sonido_select=None)

        self.natalia = BotonUsuario()
        imagenusuario = os.path.join(G.IMAGENES, "Login", "natalia.png")
        self.natalia.set_imagen(origen=imagenusuario)
        self.natalia.connect(callback=self.select_personaje,
                             sonido_select=None)

        self.personajes = [self.jacinto, self.jose, self.natalia]

        self.entrys = []
        self.board = Board()

        self.fondo = pygame.sprite.Sprite()
        self.fondo.image = (imagen)
        self.fondo.rect = self.fondo.image.get_rect()
        self.add(self.fondo)
        imagen = G.get_Flecha()
        salir = JAMButton("", None)
        salir.set_imagen(origen=imagen, tamanio=(100, 55))
        salir.set_colores(colorbas=JAMG.get_negro(),
                          colorcara=JAMG.get_negro())
        salir.set_tamanios(tamanio=(0, 0), grosorbor=1, detalle=1, espesor=1)
        salir.set_posicion(punto=(10, 10))
        salir.connect(callback=main.emit_volver, sonido_select=None)
        self.add(salir)

        # Ingresar nombre
        self.label_nombre = JAMLabel("Nombre:")
        self.label_nombre.set_text(color=(255, 255, 255, 255))
        self.label_nombre.set_font_from_file(fuente, tamanio=30)
        self.add(self.label_nombre)
        self.entry_nombre = JAMButton("", None)
        self.entrys.append(self.entry_nombre)
        self.add(self.entry_nombre)

        # Ingresar Edad
        self.label_edad = JAMLabel("Edad:")
        self.label_edad.set_text(color=(255, 255, 255, 255))
        self.label_edad.set_font_from_file(fuente, tamanio=30)
        self.add(self.label_edad)
        self.entry_edad = JAMButton("", None)
        self.entrys.append(self.entry_edad)
        self.add(self.entry_edad)

        # Ingresar escuela
        self.label_escuela = JAMLabel("Escuela:")
        self.label_escuela.set_text(color=(255, 255, 255, 255))
        self.label_escuela.set_font_from_file(fuente, tamanio=30)
        self.add(self.label_escuela)
        self.entry_escuela = JAMButton("", None)
        self.entrys.append(self.entry_escuela)
        self.add(self.entry_escuela)

        # Ingresar Clase
        self.label_clase = JAMLabel("Clase:")
        self.label_clase.set_text(color=(255, 255, 255, 255))
        self.label_clase.set_font_from_file(fuente, tamanio=30)
        self.add(self.label_clase)
        self.entry_clase = JAMButton("", None)
        self.entrys.append(self.entry_clase)
        self.add(self.entry_clase)

        # Ingresar departamento
        self.label_departamento = JAMLabel("Departamento:")
        self.label_departamento.set_text(color=(255, 255, 255, 255))
        self.label_departamento.set_font_from_file(fuente, tamanio=30)
        self.add(self.label_departamento)
        self.entry_departamento = JAMButton("", None)
        self.entrys.append(self.entry_departamento)
        self.add(self.entry_departamento)

        for boton in self.entrys:
            boton.set_alineacion_label("izquierda")
            boton.set_imagen(origen=imagen_teclado)
            boton.set_font_from_file(fuente, tamanio=25)
            boton.set_tamanios(tamanio=(300, 35),
                               grosorbor=1,
                               detalle=1,
                               espesor=1)
            boton.connect(callback=None, sonido_select=None)

        self.label_derecho = JAMLabel("Selecciona un Personaje:")
        self.label_derecho.set_text(color=(255, 255, 255, 255))
        self.label_derecho.set_font_from_file(fuente, tamanio=30)
        self.add(self.label_derecho)

        self.boton_crear = JAMButton("Crear", None)
        self.boton_crear.set_font_from_file(fuente, tamanio=30)
        self.boton_crear.set_tamanios(tamanio=(200, 40),
                                      grosorbor=1,
                                      detalle=1,
                                      espesor=1)
        self.boton_crear.set_colores(colorbas=(0, 157, 224, 255),
                                     colorbor=(0, 157, 224, 255),
                                     colorcara=(92, 193, 235, 255))
        #self.boton_crear.set_colores(colorbas = (92,193,235,255),
        #	colorbor = (255,255,255,255), colorcara = (92,193,235,255))
        self.boton_crear.set_text(color=(255, 255, 255, 255))
        self.boton_crear.connect(callback=self.crear_usuario,
                                 sonido_select=None)

        self.add(self.boton_crear)

        self.add(self.jacinto)
        self.add(self.jose)
        self.add(self.natalia)

        self.entry_nombre.connect(callback=self.enter_nombre)
        self.entry_edad.connect(callback=self.enter_edad)
        self.entry_escuela.connect(callback=self.enter_escuela)
        self.entry_clase.connect(callback=self.enter_clase)
        self.entry_departamento.connect(callback=self.enter_departamento)

    def center(self, fondo_size):
        sep = 10
        w, h = fondo_size
        x, y = (w / 2 - self.fondo.rect.w / 2, h / 2 - self.fondo.rect.h / 2)
        self.fondo.rect.x, self.fondo.rect.y = (x, y)

        x += sep * 2
        y += sep * 2

        self.label_nombre.set_posicion((x, y))
        y += self.label_nombre.get_tamanio()[1]
        self.entry_nombre.set_posicion((x, y))
        y += sep * 3 + self.entry_nombre.get_tamanio()[1]

        self.label_edad.set_posicion((x, y))
        y += self.label_edad.get_tamanio()[1]
        self.entry_edad.set_posicion((x, y))
        y += sep * 3 + self.entry_edad.get_tamanio()[1]

        self.label_escuela.set_posicion((x, y))
        y += self.label_escuela.get_tamanio()[1]
        self.entry_escuela.set_posicion((x, y))
        y += sep * 3 + self.entry_escuela.get_tamanio()[1]

        self.label_clase.set_posicion((x, y))
        y += self.label_clase.get_tamanio()[1]
        self.entry_clase.set_posicion((x, y))
        y += sep * 3 + self.entry_clase.get_tamanio()[1]

        self.label_departamento.set_posicion((x, y))
        y += self.label_departamento.get_tamanio()[1]
        self.entry_departamento.set_posicion((x, y))

        w, h = fondo_size
        mitad = self.fondo.rect.w / 2
        ww, hh = self.label_derecho.get_tamanio()
        x = self.fondo.rect.x + mitad + mitad / 2 - ww / 2
        y = self.fondo.rect.y + sep * 7
        self.label_derecho.set_posicion((x, y))

        ww, hh = self.jacinto.get_tamanio()
        x = self.fondo.rect.x + mitad + mitad / 2 - ww - sep
        y = self.label_derecho.get_posicion(
        )[1] + self.label_derecho.get_tamanio()[1] + sep
        self.jacinto.set_posicion((x, y))

        x = self.jacinto.get_posicion()[0] + self.jacinto.get_tamanio(
        )[0] + sep
        self.natalia.set_posicion((x, y))

        ww, hh = self.jose.get_tamanio()
        x = self.fondo.rect.x + mitad + mitad / 2 - ww / 2
        y = self.natalia.get_posicion()[1] + self.natalia.get_tamanio(
        )[1] + sep
        self.jose.set_posicion((x, y))

        ww, hh = self.boton_crear.get_tamanio()
        x = self.fondo.rect.x + mitad + mitad / 2 - ww / 2
        y = self.jose.get_posicion()[1] + self.jose.get_tamanio()[1] + sep * 5
        self.boton_crear.set_posicion((x, y))

    def crear_usuario(self, button):
        if self.usuario['nombre'] and self.usuario['edad'] \
         and self.usuario['escuela'] and self.usuario['clase'] \
         and self.usuario['departamento'] and self.usuario['personaje']:
            self.main.crear_usuario(self.usuario)
        else:
            print "Hay un campo sin llenar"

    def select_personaje(self, button):
        self.usuario['personaje'] = button.origen_imagen
        for personaje in self.personajes:
            if not personaje == button:
                personaje.deseleccionar()
            else:
                personaje.seleccionar()

    def enter_nombre(self, button):
        x, y = button.get_posicion()
        w, h = button.get_tamanio()
        self.board.set_posicion(punto=(x + w, y))
        self.board.callback_enter = self.add_nombre
        self.board.text_buffer = button.get_text()
        self.add(self.board)
        self.run_board(button)

    def add_nombre(self, textbuffer):
        self.estado = None
        if textbuffer: self.usuario['nombre'] = textbuffer

    def enter_edad(self, button):
        x, y = button.get_posicion()
        w, h = button.get_tamanio()
        self.board.set_posicion(punto=(x + w, y))
        self.board.callback_enter = self.add_edad
        self.board.text_buffer = button.get_text()
        self.add(self.board)
        self.run_board(button)

    def add_edad(self, textbuffer):
        self.estado = None
        if textbuffer: self.usuario['edad'] = textbuffer

    def enter_escuela(self, button):
        x, y = button.get_posicion()
        w, h = button.get_tamanio()
        self.board.set_posicion(punto=(x + w, y))
        self.board.callback_enter = self.add_escuela
        self.board.text_buffer = button.get_text()
        self.add(self.board)
        self.run_board(button)

    def add_escuela(self, textbuffer):
        self.estado = None
        if textbuffer: self.usuario['escuela'] = textbuffer

    def enter_clase(self, button):
        x, y = button.get_posicion()
        w, h = button.get_tamanio()
        self.board.set_posicion(punto=(x + w, y))
        self.board.callback_enter = self.add_clase
        self.board.text_buffer = button.get_text()
        self.add(self.board)
        self.run_board(button)

    def add_clase(self, textbuffer):
        self.estado = None
        if textbuffer: self.usuario['clase'] = textbuffer

    def enter_departamento(self, button):
        x, y = button.get_posicion()
        w, h = button.get_tamanio()
        self.board.set_posicion(punto=(x + w, y))
        self.board.callback_enter = self.add_departamento
        self.board.text_buffer = button.get_text()
        self.add(self.board)
        self.run_board(button)

    def add_departamento(self, textbuffer):
        self.estado = None
        if textbuffer: self.usuario['departamento'] = textbuffer

    def run_board(self, button):
        self.estado = "board"
        self.board.draw(self.main.ventana)
        pygame.display.update()
        while self.estado == "board":
            self.main.reloj.tick(35)
            while gtk.events_pending():
                gtk.main_iteration(False)
            G.Traduce_posiciones(self.main.VA, self.main.VH)
            self.clear(self.main.ventana, self.main.fondo)
            self.board.update()
            pygame.event.clear()
            button.set_text(texto=self.board.text_buffer)
            self.draw(self.main.ventana)
            self.main.ventana_real.blit(
                pygame.transform.scale(self.main.ventana,
                                       self.main.resolucionreal), (0, 0))
            pygame.display.update()
        self.board.clear(self.main.ventana, self.main.fondo)
        self.main.ventana_real.blit(
            pygame.transform.scale(self.main.ventana,
                                   self.main.resolucionreal), (0, 0))
        pygame.display.update()
        self.remove(self.board)