Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Cubas <vhcubas91@gmail.com>2013-01-23 20:07:00 (GMT)
committer Victor Cubas <vhcubas91@gmail.com>2013-01-23 20:07:00 (GMT)
commit316f146cbab8ef411893c2495e9da2c9fe21e234 (patch)
tree952d5b8720f6366157fffcbd44f804e1182dc6cd
parentf1306e1c12df3c1a759a7bb10df9513f2f14be58 (diff)
Modificacion final
-rw-r--r--imagen.py86
1 files changed, 49 insertions, 37 deletions
diff --git a/imagen.py b/imagen.py
index 67bd263..bbce6ab 100644
--- a/imagen.py
+++ b/imagen.py
@@ -4,24 +4,16 @@ import gtk
import programa
import voice
-b = 1
-
label_opciones = ["Claro - Oscuro", "Joven - Anciano", "Gordo - Flaco", "Alto - Bajo", "Pequeño - Grande", "Feliz - Triste"]
listImagenes = ['gordo.jpg', 'flaco.jpg','alto.jpg', 'bajo.jpg']
-correct_option = [label_opciones[2],label_opciones[3]]
-
-indice_opciones = 0
-indice_imagen = 0
-indice_resp_correcta = 0
+correct_option = [label_opciones[2], "Alto - Bajo"]
class MyApp():
def __init__(self):
- #label_opciones = ["Claro - Oscuro", "Joven - Anciano", "Gordo - Flaco", "Alto - Bajo", "Pequeño - Grande", "Feliz - Triste"]
- #listImagenes = ['gordo.jpg', 'flaco.jpg','alto.jpg', 'bajo.jpg']
- #label2 = ['Nene - Nena', 'Mucho - Poco', 'Fuego - Agua']
- #myListImagenes = [myImagenes]
- #correct_option = [label_opciones[2],label_opciones[1]]
-
+ self.indice_opciones = 0
+ self.indice_imagen = 0
+ self.indice_resp_correcta = 0
+
window = gtk.Window()
vbox = gtk.VBox()
hbox = gtk.HBox()
@@ -34,35 +26,35 @@ class MyApp():
window.set_position(gtk.WIN_POS_CENTER)
vbox.add(hbox)
- global indice_opciones
- global indice_imagen
- global indice_resp_correcta
-
imagen1 = gtk.Image()
- imagen1.set_from_file(listImagenes[indice_imagen])
- indice_imagen += 1
imagen2 = gtk.Image()
- imagen2.set_from_file(listImagenes[indice_imagen])
- indice_imagen += 1
-
button1 = gtk.Button()
- button1.set_label(label_opciones[indice_opciones])
- indice_opciones += 1
button2 = gtk.Button()
- button2.set_label(label_opciones[indice_opciones])
- indice_opciones += 1
button3 = gtk.Button()
- button3.set_label(label_opciones[indice_opciones])
- indice_opciones += 1
+ imagen1.set_from_file(listImagenes[self.indice_imagen])
+ self.indice_imagen += 1
+ imagen2.set_from_file(listImagenes[self.indice_imagen])
+ self.indice_imagen += 1
+
+ button1.set_label(label_opciones[self.indice_opciones])
+ self.indice_opciones += 1
+ button2.set_label(label_opciones[self.indice_opciones])
+ self.indice_opciones += 1
+ button3.set_label(label_opciones[self.indice_opciones])
+ self.indice_opciones += 1
+
button1.connect('enter', self.__sobre_boton_cb)
button2.connect('enter', self.__sobre_boton_cb)
button3.connect('enter', self.__sobre_boton_cb)
- button1.connect('clicked', self.__correcto_cb, correct_option[indice_resp_correcta])
- button2.connect('clicked', self.__correcto_cb, correct_option[indice_resp_correcta])
- button3.connect('clicked', self.__correcto_cb, correct_option[indice_resp_correcta])
- #print indice_resp_correcta
- indice_resp_correcta += 1
+ button1.connect('clicked', self.__correcto_cb, correct_option[self.indice_resp_correcta], imagen1,
+ imagen2, button1, button2, button3)
+ button2.connect('clicked', self.__correcto_cb, correct_option[self.indice_resp_correcta], imagen1,
+ imagen2, button1, button2, button3)
+ button3.connect('clicked', self.__correcto_cb, correct_option[self.indice_resp_correcta], imagen1,
+ imagen2, button1, button2, button3)
+
+ #print correct_option[self.indice_resp_correcta]
hbox.add(imagen1)
hbox.add(imagen2)
@@ -71,14 +63,34 @@ class MyApp():
vbox.add(button3)
window.show_all()
- def __correcto_cb(self, button, clave):
+ def resetear(self, imagen1, imagen2, button1, button2, button3):
+ imagen1.set_from_file(listImagenes[self.indice_imagen])
+ self.indice_imagen += 1
+ imagen2.set_from_file(listImagenes[self.indice_imagen])
+ self.indice_imagen += 1
+
+ button1.set_label(label_opciones[self.indice_opciones])
+ self.indice_opciones += 1
+ button2.set_label(label_opciones[self.indice_opciones])
+ self.indice_opciones += 1
+ button3.set_label(label_opciones[self.indice_opciones])
+ self.indice_opciones += 1
+ print self.indice_resp_correcta
+ self.indice_resp_correcta += 1
+ print self.indice_resp_correcta
+
+ def __correcto_cb(self, button, clave, imagen1, imagen2, button1, button2, button3):
if button.get_label() == clave:
+ #print clave
voice.say('Opcion correcta')
- my_app = MyApp()
- gtk.main()
+ #self.indice_resp_correcta += 1
+ self.resetear(imagen1, imagen2, button1, button2, button3)
+ print self.indice_resp_correcta
else:
+ print clave
voice.say('Opcion incorrecta')
-
+
+
def destroy(self, window, data=None):
gtk.main_quit()