Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 2 down vote accepted

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.

share|improve this answer
Oh, sure, it inherits from gtk.Container. Thanks for quick tip! – Rafał Cieślak Jan 6 '11 at 17:01
By the way, is it possible to add it using gtk.UIManager? – Rafał Cieślak Jan 6 '11 at 17:03
I think it's not possible, but I don't know - I always use GtkBuilder and Glade instead. – Stefano Palazzo Jan 6 '11 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. – Rafał Cieślak Jan 7 '11 at 20:36
Oh, got it to work. Had to add a ToolItem into the tooblar, then call toolitem.add(spinbutton). – Rafał Cieślak Jan 8 '11 at 20:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.