From f1306e1c12df3c1a759a7bb10df9513f2f14be58 Mon Sep 17 00:00:00 2001 From: Victor Cubas Date: Wed, 23 Jan 2013 13:45:24 +0000 Subject: Nuevas Imagenes --- diff --git a/imagen.py b/imagen.py index adf2709..67bd263 100644 --- a/imagen.py +++ b/imagen.py @@ -4,15 +4,23 @@ 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 class MyApp(): def __init__(self): - - label_opciones = ["Claro - Oscuro", "Joven - Anciano", "Gordo - Flaco", "Alto - Bajo", "Pequeño - Grande", "Feliz - Triste"] + #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'] - listImagenes = ['gordo.jpg', 'flaco.jpg','alto.jpg', 'bajo.jpg'] #myListImagenes = [myImagenes] - correct_option = [label_opciones[2],label_opciones[1]] + #correct_option = [label_opciones[2],label_opciones[1]] window = gtk.Window() vbox = gtk.VBox() @@ -21,52 +29,55 @@ class MyApp(): window.connect('destroy', self.destroy) window.add(vbox) window.set_title('Piensa y Escribe') - window.set_default_size(100,100) + #window.set_default_size(100,100) + window.set_size_request(700,600) window.set_position(gtk.WIN_POS_CENTER) vbox.add(hbox) - indice_opciones = 0 - indice_imagen = 0 - indice_resp_correcta = 0 + global indice_opciones + global indice_imagen + global indice_resp_correcta - while indice_imagen < 4: - 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 - 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) - button2.connect('clicked', self.__correcto_cb) - button3.connect('clicked', self.__correcto_cb) - indice_resp_correcta +=1 - hbox.add(imagen1) - hbox.add(imagen2) - vbox.add(button1) - vbox.add(button2) - vbox.add(button3) - window.show_all() - - - + 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 + + 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 + + hbox.add(imagen1) + hbox.add(imagen2) + vbox.add(button1) + vbox.add(button2) + vbox.add(button3) + window.show_all() - def __correcto_cb(self, button): - if button.get_label() == correct_opcion[2]: + def __correcto_cb(self, button, clave): + if button.get_label() == clave: voice.say('Opcion correcta') + my_app = MyApp() + gtk.main() else: - voice.say('Opcion incorrecta - Intente de nuevo') + voice.say('Opcion incorrecta') def destroy(self, window, data=None): gtk.main_quit() -- cgit v0.9.1