Advertisement
Guest User

Simple Toolbar

a guest
Jan 31st, 2011
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.00 KB | None | 0 0
  1. class PyApp(gtk.Window):
  2.     def __init__(self):
  3.         # Added scaffolding to get it to actually run
  4.         super(PyApp, self).__init__()
  5.  
  6.         self.set_title("Toolbar")
  7.         self.set_size_request(250, 200)
  8.         self.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(6400, 6400, 6440))
  9.         self.set_position(gtk.WIN_POS_CENTER)
  10.  
  11.         # Start of edited code
  12.         vBox = gtk.VBox(False, 0)
  13.         vBox.set_size_request(400,500)
  14.         vBox.set_border_width(2)
  15.         self.add(vBox)
  16.  
  17.         bar = gtk.Toolbar()
  18.         bar.set_style(gtk.TOOLBAR_ICONS)
  19.         closeButt = gtk.ToolButton(gtk.STOCK_CLOSE)
  20.         # You can do your original non-stock button instead,
  21.         # but must make it text instead of icons then.
  22.         bar.insert(closeButt,0)
  23.         vBox.pack_start(bar, False, False, 0)
  24.         # End of edited code
  25.  
  26.         # More scaffolding to make it into a running program
  27.         self.connect("destroy", gtk.main_quit)
  28.         self.show_all()
  29.  
  30. PyApp()
  31. gtk.main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement