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 create a toolbar with buttons that look like the ones in Software Center?

I've figured out out to set the style of the toolbar to Gtk.STYLE_CLASS_PRIMARY_TOOLBAR, but I want to set the buttons to look like page selectors instead of regular buttons.

I'm trying to create a bunch of buttons to switch between pages according to this specification: Contributor Console


share|improve this question
Quick tip: Software Center is also written in Python/GTK3. Head over to their Launchpad page, grab the source and have a look at how they do it. – Timo Nov 23 '12 at 11:36
I've looked through the code and can't figure out what it does to make the buttons look like that. – iBelieve Nov 23 '12 at 13:40
up vote 1 down vote accepted

The Global Pane in the code sets up the toolbar: softwarecenter/ui/gtk3/panes/

While the ViewSwitcher class draws the buttons on the Global Pane: softwarecenter/ui/gtk3/panes/

Each button is added as a custom SectionSelector class composed of a custom cairo drawn Gtk.Image (SymbolicIcon class), a label and an optional drop down channel selector. You should check out the file for more detail.

The SectionSelector class is in: softwarecenter/ui/gtk3/widgets/ and is itself built from a custom class in that file.

Luckily, most of the code looks very reusable so you can probably copy and use them in your software.

share|improve this answer
Great! Thanks for your answer, I'll try it later. – iBelieve Nov 26 '12 at 20:33

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.