Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaolo Monsalvo <pmonsalvo@gmail.com>2013-01-24 21:09:47 (GMT)
committer Paolo Monsalvo <pmonsalvo@gmail.com>2013-01-24 21:09:47 (GMT)
commit2bb0bc1496325fc79789e76707d509a838f3ed63 (patch)
treeaeabd012d3a64414ce0865f7c24041aa7963edc5
parent78a56f0fca930294f7b8b29f0345bfd642e7095e (diff)
Actualizacion 3
-rw-r--r--activity.py90
-rw-r--r--config.ini5
-rw-r--r--prueba.py123
3 files changed, 121 insertions, 97 deletions
diff --git a/activity.py b/activity.py
index 85bf7f8..c8d05da 100644
--- a/activity.py
+++ b/activity.py
@@ -77,27 +77,27 @@ class JugandoAprendesActivity(activity.Activity):
self.connect('key-press-event', self.__key_press_cb)
- vbox.add(hbox)
+ vbox.add(self.hbox)
- image=gtk.Image()
- image.set_from_file('imagenes/derecha.png')
- image.show()
- hbox.pack_start(image)
-
- image=gtk.Image()
- image.set_from_file('imagenes/izquierda.png')
- image.show()
- hbox.pack_start(image)
-
- image=gtk.Image()
- image.set_from_file('imagenes/arriba.png')
- image.show()
- hbox.pack_start(image)
-
- image=gtk.Image()
- image.set_from_file('imagenes/abajo.png')
- image.show()
- hbox.pack_start(image)
+ self.image1=gtk.Image()
+ self.image1.set_from_file('imagenes/derecha.png')
+ self.image1.show()
+ self.hbox.pack_start(self.image1)
+
+ self.image2=gtk.Image()
+ self.image2.set_from_file('imagenes/izquierda.png')
+ self.image2.show()
+ self.hbox.pack_start(self.image2)
+
+ self.image3=gtk.Image()
+ self.image3.set_from_file('imagenes/arriba.png')
+ self.image3.show()
+ self.hbox.pack_start(self.image3)
+
+ self.image4=gtk.Image()
+ self.image4.set_from_file('imagenes/abajo.png')
+ self.image4.show()
+ self.hbox.pack_start(self.image4)
vbox.show_all()
@@ -116,28 +116,34 @@ class JugandoAprendesActivity(activity.Activity):
self.patron=['arriba','abajo','izquierda', 'derecha']
random.shuffle(self.patron)
self.p=" ".join(self.patron)
- #self.hbox.clear()
- image=gtk.Image()
- image.set_from_file('imagenes/'+patron[0]+'.png')
- image.show()
- self.hbox.pack_start(image)
-
- image=gtk.Image()
- image.set_from_file('imagenes/'+patron[1]+'.png')
- image.show()
- self.hbox.pack_start(image)
-
- image=gtk.Image()
- image.set_from_file('imagenes/'+patron[2]+'.png')
- image.show()
- self.hbox.pack_start(image)
-
- image=gtk.Image()
- image.set_from_file('imagenes/'+patron[3]+'.png')
- image.show()
- self.hbox.pack_start(image)
- self.leer_patrones()
-
+ self.hbox.remove(self.image1)
+ self.hbox.remove(self.image2)
+ self.hbox.remove(self.image3)
+ self.hbox.remove(self.image4)
+
+ self.image1=gtk.Image()
+ self.image1.set_from_file('imagenes/'+self.patron[0]+'.png')
+ self.image1.show()
+ self.hbox.pack_start(self.image1)
+
+
+ self.image2=gtk.Image()
+ self.image2.set_from_file('imagenes/'+self.patron[1]+'.png')
+ self.image2.show()
+ self.hbox.pack_start(self.image2)
+
+
+ self.image3=gtk.Image()
+ self.image3.set_from_file('imagenes/'+self.patron[2]+'.png')
+ self.image3.show()
+ self.hbox.pack_start(self.image3)
+
+
+ self.image4=gtk.Image()
+ self.image4.set_from_file('imagenes/'+self.patron[3]+'.png')
+ self.image4.show()
+ self.hbox.pack_start(self.image4)
+ self.leer_patrones()
def __key_press_cb(self, window, event, label):
diff --git a/config.ini b/config.ini
index 0500ffc..afc7a0c 100644
--- a/config.ini
+++ b/config.ini
@@ -1,5 +1,2 @@
[inicio]
-patron = ['Bienvenido', 'a','Jugando', 'Aprendes']
-
-[patron1]
-patron = ['arriba','abajo','izquierda','derecha']
+patron = ['Bienvenido a Jugando Aprendes. Presiona la tecla espacio para empezar el juego']
diff --git a/prueba.py b/prueba.py
index 76fa63d..debf8a9 100644
--- a/prueba.py
+++ b/prueba.py
@@ -36,81 +36,102 @@ class MyApp():
#if(self.key_name==patr
-
- #def controlar_patrones():
- # for i in range(4):
- # if (self.patron[i]==self.key_name):
- # self.say('Correcto')
+
+ def controlar_patrones(self):
+ print 'entra'
+ if (self.key_name != 'space'):
+ i=0
+ while (i<3):
+ if (self.patron[i]==self.key_name):
+ self.say('Correcto')
+ print 'estoy en el if'
+ i+=1
+ else:
+ self.say('Incorrecto')
+ self.leer_patrones()
+ print 'estoy en el else'
+ i=0
+ break
+ self.controlar_patrones()
+
# else:
# self.say('Incorrecto. Vuelva a intentarlo desde el inicio')
# controlar_patrones()
#self.say('Felicidades, has acertado totalmente. Aprieta espacio para generar un nuevo patron')
-
+
def leer_patrones(self):
- self.say(self.p)
- #self.controlar_patrones()
+ self.say(self.p)
+ self.controlar_patrones()
+
def generar_patrones(self):
self.patron=['arriba','abajo','izquierda', 'derecha']
random.shuffle(self.patron)
self.p=" ".join(self.patron)
- self.hbox.clear()
- image=gtk.Image()
- image.set_from_file('imagenes/'+patron[0]+'.png')
- image.show()
- self.hbox.pack_start(image)
-
- image=gtk.Image()
- image.set_from_file('imagenes/'+patron[1]+'.png')
- image.show()
- self.hbox.pack_start(image)
-
- image=gtk.Image()
- image.set_from_file('imagenes/'+patron[2]+'.png')
- image.show()
- self.hbox.pack_start(image)
-
- image=gtk.Image()
- image.set_from_file('imagenes/'+patron[3]+'.png')
- image.show()
- self.hbox.pack_start(image)
+ self.hbox.remove(self.image1)
+ self.hbox.remove(self.image2)
+ self.hbox.remove(self.image3)
+ self.hbox.remove(self.image4)
+
+ self.image1=gtk.Image()
+ self.image1.set_from_file('imagenes/'+self.patron[0]+'.png')
+ self.image1.show()
+ self.hbox.pack_start(self.image1)
+
+
+ self.image2=gtk.Image()
+ self.image2.set_from_file('imagenes/'+self.patron[1]+'.png')
+ self.image2.show()
+ self.hbox.pack_start(self.image2)
+
+
+ self.image3=gtk.Image()
+ self.image3.set_from_file('imagenes/'+self.patron[2]+'.png')
+ self.image3.show()
+ self.hbox.pack_start(self.image3)
+
+
+ self.image4=gtk.Image()
+ self.image4.set_from_file('imagenes/'+self.patron[3]+'.png')
+ self.image4.show()
+ self.hbox.pack_start(self.image4)
self.leer_patrones()
def cargar_ui(self):
- self.window = gtk.Window()
+ window = gtk.Window()
vbox = gtk.VBox()
- hbox = gtk.HBox()
+ self.hbox = gtk.HBox()
label = gtk.Label()
- self.window.connect('destroy', self.destroy)
- self.window.connect('key-press-event', self.__key_press_cb, label)
- self.window.add(vbox)
+ window.connect('destroy', self.destroy)
+ window.connect('key-press-event', self.__key_press_cb, label)
+ window.add(vbox)
- vbox.add(hbox)
+ vbox.add(self.hbox)
- image=gtk.Image()
- image.set_from_file('imagenes/derecha.png')
- image.show()
- hbox.pack_start(image)
+ self.image1=gtk.Image()
+ self.image1.set_from_file('imagenes/derecha.png')
+ self.image1.show()
+ self.hbox.pack_start(self.image1)
- image=gtk.Image()
- image.set_from_file('imagenes/izquierda.png')
- image.show()
- hbox.pack_start(image)
+ self.image2=gtk.Image()
+ self.image2.set_from_file('imagenes/izquierda.png')
+ self.image2.show()
+ self.hbox.pack_start(self.image2)
- image=gtk.Image()
- image.set_from_file('imagenes/arriba.png')
- image.show()
- hbox.pack_start(image)
+ self.image3=gtk.Image()
+ self.image3.set_from_file('imagenes/arriba.png')
+ self.image3.show()
+ self.hbox.pack_start(self.image3)
- image=gtk.Image()
- image.set_from_file('imagenes/abajo.png')
- image.show()
- hbox.pack_start(image)
+ self.image4=gtk.Image()
+ self.image4.set_from_file('imagenes/abajo.png')
+ self.image4.show()
+ self.hbox.pack_start(self.image4)
- self.window.show_all()
+ window.show_all()
def destroy(self, window, data=None):