This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Simple Toolbar

By: a guest on Jan 31st, 2011  |  syntax: Python  |  size: 1.00 KB  |  views: 50  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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()
clone this paste RAW Paste Data