Advertisement
hackloper775

Spin Gtk

Oct 22nd, 2013
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. from gi.repository import Gtk
  2.  
  3. class SpinButtonWindow(Gtk.Window):
  4.  
  5.     def __init__(self):
  6.         Gtk.Window.__init__(self, title="SpinButton Demo")
  7.         self.set_border_width(10)
  8.  
  9.         hbox = Gtk.Box(spacing=6)
  10.         self.add(hbox)
  11.  
  12.         self.adjustment = Gtk.Adjustment(0, 0, 10, 2, 0, 0)
  13.         self.spinbutton = Gtk.SpinButton()
  14.         self.spinbutton.set_adjustment(self.adjustment)
  15.         self.spinbutton.connect("value-changed", self.clic,None)
  16.         hbox.pack_start(self.spinbutton, False, False, 0)
  17.        
  18.     def clic(self,boton,signal):
  19.         print boton.get_value() # Con esta funcion nos devuelve un float
  20.         print boton.get_value_as_int() # Con esta un int
  21.            
  22. win = SpinButtonWindow()
  23. win.connect("delete-event", Gtk.main_quit)
  24. win.show_all()
  25. Gtk.main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement