Advertisement
Guest User

GTK REVEALER PROBLEM SC

a guest
Jun 13th, 2016
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.22 KB | None | 0 0
  1. from gi.repository import Gtk
  2. from gi.repository import Gdk
  3.  
  4. def revealer_child(button):
  5.     if revealer.get_reveal_child():
  6.         revealer.set_reveal_child(False)
  7.         revealer.hide()
  8.     else:
  9.         revealer.set_reveal_child(True)
  10.         revealer.show()
  11.  
  12. window = Gtk.Window()
  13. window.set_size_request(Gdk.Screen.get_default().get_width(),20)
  14. window.connect('destroy',Gtk.main_quit)
  15. window.set_size_request(
  16.     Gdk.Screen.get_default().get_width(),
  17.     20)
  18.  
  19. grid = Gtk.Grid()
  20. window.add(grid)
  21.  
  22. revealer = Gtk.Revealer()
  23. revealer.set_reveal_child(False)
  24. grid.attach(revealer,0,1,1,1)
  25.  
  26. notebook = Gtk.Notebook()
  27. for i in range(10):
  28.     box = Gtk.Box()
  29.     box.set_size_request(
  30.         Gdk.Screen.get_default().get_width(),
  31.         Gdk.Screen.get_default().get_height())
  32.        
  33.     container = Gtk.FlowBox()
  34.     container.set_valign(Gtk.Align.START)
  35.     container.set_max_children_per_line(30)
  36.     container.set_selection_mode(Gtk.SelectionMode.NONE)
  37.        
  38.     for j in range(10):
  39.         button = Gtk.Button("%d" % i)
  40.         container.add(button)
  41.    
  42.     box.add(container)
  43.     notebook.append_page(box,Gtk.Label("Label"))
  44.    
  45. revealer.add(notebook)
  46.  
  47. button = Gtk.Button("Revealer")
  48. button.connect("clicked",revealer_child)
  49. grid.attach(button,0,0,1,1)
  50.  
  51. window.show_all()
  52.  
  53. Gtk.main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement