-
Notifications
You must be signed in to change notification settings - Fork 0
/
Puntos.py
45 lines (37 loc) · 1.43 KB
/
Puntos.py
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
# -*- encoding: utf-8 -*-
import pilas
import Menu
class Puntos(pilas.escena.Base):
def __init__(self):
pilas.escena.Base.__init__(self)
def iniciar(self):
fondo = pilas.fondos.Nubes()
pilas.actores.Texto('Ingresa tu nombre\n"Aceptar para guardar y volver al menu principal"',y=200)
entrada = pilas.interfaz.IngresoDeTexto()
b = pilas.actores.Boton()
b.texto = ""
b.y = -100
def cuando_pulsan_el_boton():
b.pintar_presionado()
texto = str(entrada.texto)
archPuntos = open('puntos.txt','r')
puntaje = archPuntos.read()
if len(puntaje)==2:
puntajeOK = '000'+str(puntaje)
elif len(puntaje)==3:
puntajeOK = '00'+str(puntaje)
elif len(puntaje)==4:
puntajeOK = '0'+str(puntaje)
elif len(puntaje)==5:
puntajeOK = str(puntaje)
guardar = open('Puntos/'+puntajeOK+'_'+texto,'w')
pilas.cambiar_escena(Menu.Menu())
def cuando_deja_de_pulsar():
b.pintar_normal()
b.conectar_presionado(cuando_pulsan_el_boton)
b.conectar_normal(cuando_deja_de_pulsar)
self.pulsa_tecla_escape.conectar(self.cuando_se_presione_escape)
def cuando_se_presione_escape(self, *k, **kv):
"Regresa al menu principal"
import Menu
pilas.cambiar_escena(Menu.Menu())