Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpamarilla <pj.amarilla@gmail.com>2013-01-18 20:44:56 (GMT)
committer pamarilla <pj.amarilla@gmail.com>2013-01-18 20:44:56 (GMT)
commitd28dc116a5af9a29310e4630617a2851cd8b90a1 (patch)
treeced2199c24610aaf76921a460e7682ed0031b629
parent883b0e16fa08a2fe435d73cb07269ab545507364 (diff)
prueba de contenedor de botones
-rw-r--r--py/tableTest.py76
1 files changed, 76 insertions, 0 deletions
diff --git a/py/tableTest.py b/py/tableTest.py
new file mode 100644
index 0000000..5b65e53
--- /dev/null
+++ b/py/tableTest.py
@@ -0,0 +1,76 @@
+# ensure that PyGTK 2.0 is loaded - not an older version
+import pygtk
+pygtk.require('2.0')
+# import the GTK module
+import gtk
+import gobject
+
+DELAY = 1000
+
+
+class MyGUI:
+
+ def __init__( self, title):
+ self.window = gtk.Window()
+ self.title = title
+ self.window.set_title( title)
+
+ self.window.set_size_request( 260, -1)
+ self.window.connect( "destroy", self.destroy)
+
+ self.table = gtk.Table(4, 4)
+ self.create_interior(self.table)
+
+ self.window.show_all()
+
+ self._button_index = 0
+ gobject.timeout_add(DELAY, self.__timeout_cb, self.table)
+
+ def create_interior( self, table):
+ self.window.add(table)
+ uno = gtk.Button( "UNO")
+ dos = gtk.Button( "DOS")
+ tres = gtk.Button( "TRES")
+ cuatro = gtk.Button( "CUATRO")
+ #self.table.attach(child, left_attach, right_attach, top_attach, bottom_attach)
+ table.attach( uno, 0, 1, 0, 1)
+ uno.show()
+ table.attach( dos, 0, 1, 1, 2)
+ dos.show()
+ table.attach( tres, 0, 1, 2, 3)
+ tres.show()
+ table.attach( cuatro, 0, 1, 3, 4)
+ cuatro.show()
+
+ a = gtk.Button("A")
+ table.attach(a, 1, 2, 1, 2)
+ a.show()
+ b = gtk.Button("B")
+ table.attach(b, 2, 3, 1, 2)
+ b.show()
+ c = gtk.Button("C")
+ table.attach(c, 3, 4, 1, 2)
+ c.show()
+ # show the table
+ table.show()
+
+ def __timeout_cb(self, table):
+
+ buttonsV = table.get_children()
+ print buttonsV[1].get_label()
+ self._button_index = (self._button_index + 1) % len(buttonsV)
+
+ button = buttonsV[self._button_index]
+ button.grab_focus()
+
+ return True
+
+ def main( self):
+ gtk.main()
+
+ def destroy( self, w):
+ gtk.main_quit()
+
+if __name__ == "__main__":
+ m = MyGUI( "Table example")
+ m.main()