[maemo-users] question about button border colour

From: Brian Keck bwkeck at gmail.com
Date: Mon Dec 27 07:02:51 EET 2010

I've been baffled in my attempts to get rid of a minor ugliness in the
appearance of my 1st python/gtk/hildon/fremantle/n900 app.

The graphical part is simple, & appended below.

Currently it just shows a list of author's names.  Each author is a
button containing an hbox.  Each hbox contains 2 labels.  The buttons
are packed into a vbox, which is in a pannablearea.

Where I've been having trouble is in getting the background to be
completely (ie apart from the text) black (just because it looks best),
& being thwarted by the button borders.  These & the button background
seem to be unalterably grey.  I've got rid of the greyness after the
author name by adding the 2nd label which in each case is 200 spaces
inside <span background="black">.  Yuk.  I've got rid of most of the
border by inner-border = {0, 0, 0, 0}.  But the button ends are rounded,
& just to the left of each author name there's a nasty little grey nail

I've tried {-10, 0, 0,0}.  Also in the rcstring, I've tried 'widget' &
'widget_class' clauses as well as the 'class' clause.  I've re-read
/etc/hildon/theme/gtk-2.0/gtkrc many times.

If someone's feeling unreasonably generous, I'd be happy to send the
books.py module that the graphical part ('books') imports.

Thanks for any help.

Brian Keck


#!/usr/bin/env python2.5

import os, sys
import re
import gtk, hildon, osso
import books

rcstring = """
style "black-background"
  bg[NORMAL] = { 0.0, 0.0, 0.0 }
  base[NORMAL] = { 0.0, 0.0, 0.0 }
  fg[NORMAL] = { 1.0, 1.0, 1.0 }
  GtkButton::inner-border = {0, 0, 0, 0}
class "GtkButton" style "black-background"

osso.Context('org.maemo.books', '1.0', False)

window = hildon.Window()
window.connect("destroy", gtk.main_quit)

pannable_area = hildon.PannableArea()

vbox = gtk.VBox(False, 0)

for author in books.authors:
  label = gtk.Label()

  label2 = gtk.Label()
  label2.set_markup('<span background="black">' + ' ' * 200 + '</span>')

  hbox = gtk.HBox(False, 0)
  hbox.pack_start(label, False, True, 0)
  hbox.pack_start(label2, False, True, 0)

  button = gtk.Button()
  vbox.pack_start(button, False, True, 0)



More information about the maemo-users mailing list