Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.ini9
-rwxr-xr-xexample.py68
2 files changed, 77 insertions, 0 deletions
diff --git a/config.ini b/config.ini
new file mode 100644
index 0000000..73a45b0
--- /dev/null
+++ b/config.ini
@@ -0,0 +1,9 @@
+[mama]
+palabra = mama
+op1 = '3 silabas'
+op2 = '2 silabas'
+op3 = '4 silabas'
+opc = op2
+silaba = 'ma ma'
+
+
diff --git a/example.py b/example.py
new file mode 100755
index 0000000..2cf3211
--- /dev/null
+++ b/example.py
@@ -0,0 +1,68 @@
+#!/usr/bin/python
+import gtk
+import gobject
+from ConfigParser import SafeConfigParser
+from subprocess import Popen
+
+class MyApp():
+
+ def __init__(self):
+
+ parser = SafeConfigParser()
+ parser.read('config.ini')
+
+ window = gtk.Window()
+ vbox = gtk.VBox()
+ hbox = gtk.HBox()
+ label = gtk.Label()
+
+ window.connect('destroy', self.destroy)
+
+ window.add(vbox)
+ vbox.add(label)
+ vbox.add(hbox)
+
+ label.set_label(parser.get('mama', 'palabra'))
+ button1 = gtk.Button()
+ button2 = gtk.Button()
+ button3 = gtk.Button()
+ button1.set_label(parser.get('mama', 'op1'))
+ button2.set_label(parser.get('mama', 'op2'))
+ button3.set_label(parser.get('mama', 'op3'))
+
+ hbox.add(button1)
+ hbox.add(button2)
+ hbox.add(button3)
+
+ text = parser.get('mama', 'silaba')
+ datac = parser.get('mama', 'opc')
+ button1.connect('clicked', self.__button_clicked_cb, 'op1', datac)
+ button2.connect('clicked', self.__button_clicked_cb, 'op2', datac)
+ button3.connect('clicked', self.__button_clicked_cb, 'op3', datac)
+
+ window.show_all()
+
+
+ def destroy(self, window, data=None):
+ gtk.main_quit()
+
+ def say(text):
+ Popen(['espeak', '-v', 'es', text])
+
+ def hablar():
+ say('Hola tch')
+
+ def __button_clicked_cb(self, button, data=None, opc=None):
+ if data == opc:
+ print "OPCION CORRECTA"
+ hablar()
+ else :
+ print "OPCION INCORRECTA"
+
+
+
+if __name__ == "__main__":
+ my_app = MyApp()
+ gtk.main()
+
+