Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from gi.repository import Gtk
- class Ejemplo(Gtk.Window):
- def __init__(self):
- Gtk.Window.__init__(self, title="Ejemplo")
- grid = Gtk.Grid()
- self.add(grid) # Añadimos el grid a la ventana
- self.btn = Gtk.Button(label="Boton 1")
- self.btn2 = Gtk.Button(label="Boton 2")
- self.btn3 = Gtk.Button(label="Boton 3")
- grid.add(self.btn) # Añadimos el boton a la grid
- grid.attach_next_to(self.btn2, self.btn, Gtk.PositionType.BOTTOM, 1, 1) # Añadimos el boton dos abajo del boton 1
- grid.attach_next_to(self.btn3, self.btn, Gtk.PositionType.LEFT, 1,2) # Añadimos el boton tres al lado izquierdo del boton uno con tamaño de dos botones en altura.
- ejem = Ejemplo()
- ejem.connect("delete-event", Gtk.main_quit)
- ejem.show_all()
- Gtk.main()
Advertisement
Add Comment
Please, Sign In to add comment