Advertisement
hackloper775

box Gtk3

Oct 22nd, 2013
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.13 KB | None | 0 0
  1. from gi.repository import Gtk
  2.  
  3. class Ejemplo(Gtk.Window):
  4.     def __init__(self):
  5.         Gtk.Window.__init__(self,title="Ejemplo RadioButon")
  6.         self.pos = [Gtk.Orientation.HORIZONTAL,Gtk.Orientation.VERTICAL]
  7.        
  8.         self.vbox = Gtk.Box()
  9.         self.vbox.set_spacing(5)
  10.         self.vbox.set_orientation(self.pos[1])
  11.        
  12.         self.boton1 = Gtk.Button()
  13.         self.boton1.set_label("Hola mundo")
  14.         self.boton1.set_tooltip_text("Oprime para ver Hola mundo en la consola")
  15.         self.boton1.connect("clicked", self.clic, 1)
  16.         self.vbox.pack_start(self.boton1,True,False,10)
  17.  
  18.         self.boton2 = Gtk.Button()
  19.         self.boton2.set_label("Salir")
  20.         self.boton2.set_tooltip_text("Oprime para salir")
  21.         self.boton2.connect("clicked", self.clic, 2)
  22.         self.vbox.pack_start(self.boton2,True,False,10)
  23.  
  24.         self.add(self.vbox)
  25.     def clic(self,boton,signal):
  26.         if signal == 1:
  27.             print "Hola Mundo"
  28.         else:
  29.             Gtk.main_quit()
  30.            
  31. ejem =  Ejemplo()
  32.  
  33. ejem.connect("delete-event",Gtk.main_quit)
  34.  
  35. ejem.show_all()
  36.  
  37. Gtk.main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement