1

How do I place a SpinButton widget on a Toolbar using GTK, or GTKmm?

1 Answer 1

2

A gtkToolbar accept any gktWidget, like any other container. An example in python:

import gtk
root = gtk.Window() toolbar = gtk.Toolbar() root.add(toolbar)
spinbutton = gtk.SpinButton() toolbar.add(spinbutton)
root.show_all() gtk.main()
alt text

So this works just like adding the GtkToolbar to the GtkWindow.

5
  • Oh, sure, it inherits from gtk.Container. Thanks for quick tip! Jan 6, 2011 at 17:01
  • By the way, is it possible to add it using gtk.UIManager? Jan 6, 2011 at 17:03
  • I think it's not possible, but I don't know - I always use GtkBuilder and Glade instead. Jan 6, 2011 at 17:15
  • Whoops. That does not work. It does compile, but running the application results with an error message in the stdio, stating that this is ToolBar's deprecated API. Jan 7, 2011 at 20:36
  • Oh, got it to work. Had to add a ToolItem into the tooblar, then call toolitem.add(spinbutton). Jan 8, 2011 at 20:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .