Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/elegir/elegir.py~
diff options
context:
space:
mode:
Diffstat (limited to 'elegir/elegir.py~')
-rw-r--r--elegir/elegir.py~86
1 files changed, 86 insertions, 0 deletions
diff --git a/elegir/elegir.py~ b/elegir/elegir.py~
new file mode 100644
index 0000000..ca18662
--- /dev/null
+++ b/elegir/elegir.py~
@@ -0,0 +1,86 @@
+#!/usr/bin/python
+import gtk
+import gobject
+import random
+from ConfigParser import SafeConfigParser
+
+from subprocess import Popen
+
+
+class MyApp():
+
+
+ def __init__(self,puntaje=0,numero=1):
+ self.puntaje=puntaje
+ self.numero=numero
+ Popen(['espeak', '-v', 'es', 'Como se escribe la palabra cubo????'])
+ image = gtk.Image()
+ #image = gtk.image_new_from_pixbuf(gtk.gdk.pixbuf_new_from_file_at_size('imagenes/cubo.jpg', 100, 100))
+ image.set_from_file('imagenes/cubo.jpg')
+
+ window = gtk.Window()
+ window.set_position(gtk.WIN_POS_CENTER)
+ window.set_border_width(200)
+ window.set_title('ELEGIR')
+ vbox = gtk.VBox()
+ hbox = gtk.HBox()
+ button_1 = gtk.Button("cubo")
+ button_2 = gtk.Button("cuvo")
+ button_3 = gtk.Button("kubo")
+
+ window.connect('destroy', self.destroy)
+ button_1.connect('clicked',self.cambio, button_2,button_3,image,1)
+ button_2.connect('clicked',self.cambio, button_1,button_3,image,0)
+ button_3.connect('clicked',self.cambio, button_1,button_2,image,0)
+
+
+ window.add(vbox)
+ vbox.add(image)
+ vbox.add(hbox)
+ hbox.add(button_1)
+ hbox.add(button_2)
+ hbox.add(button_3)
+
+ window.show()
+ vbox.show()
+ image.show()
+ hbox.show()
+ button_1.show()
+ button_2.show()
+ button_3.show()
+
+ def cambio(self,b,b2=None,b3=None,i=None,p=0):
+ parser = SafeConfigParser()
+ parser.read('config.ini')
+ if b.get_label()== parser.get('pregunta'+str(self.numero), 'correcta'):
+ text ='Felicidades, elegiste la respuesta correcta!!!' + b.get_label()
+ print 'Felicidades, elegiste la respuesta correcta!!!'
+ else:
+ text ='La palabra seleccionada, no es la correcta'
+ print 'Felicidades, elegiste la respuesta correcta!!!'
+
+ self.puntaje=self.puntaje +p
+ text=text + ' tu puntajes adicional es : ' + str(p)
+ Popen(['espeak', '-v', 'es', text])
+ # parser = SafeConfigParser()
+ # NECESITO UNA PAUSA ANTES DE CAMBIAR LA FIGURA
+
+
+ self.numero=random.randint(1,4)# pregunta seleccionada al azar
+ #i = gtk.image_new_from_pixbuf(gtk.gdk.pixbuf_new_from_file_at_size(parser.get('pregunta'+str(self.numero), 'imagen'), 100, 100))
+ i.set_from_file(parser.get('pregunta'+str(self.numero), 'imagen'))
+ b3.set_label(parser.get('pregunta'+str(self.numero), 'correcta'))
+ b.set_label(parser.get('pregunta'+str(self.numero), 'incorrecta1'))
+ b2.set_label(parser.get('pregunta'+str(self.numero), 'incorrecta2'))
+
+
+ def say(self,b,text):
+ Popen(['espeak', '-v', 'es', text])
+
+ def destroy(self, window, data=None):
+ gtk.main_quit()
+
+
+if __name__ == "__main__":
+ my_app = MyApp()
+ gtk.main()