[pygtk] How to align entries in a table?

Sandro Dentella sandro at e-den.it
Fri Jan 27 06:43:54 WST 2006

Hi all,

   I'd like to understand how to align entry in a table  so that it will be
   "anchored" to the left. I can't find a way, not even using glade. The
   idea is that while creating a mask to input data I'd like each entry to
   be large no more than the allowed chars (I see that that's  possible using
   widht-chars if the container is a table, not if the container is VBox),
   and further I'd like to anchor the entry to the write, while I only get
   it in the center.

        city:  [     large entry       ]
    zip code:  [5chars]

   what I get instead is:

        city:  [     large entry       ]
    zip code:           [5chars]

    Which is the normal way to get this?


class SampleWindow(gtk.Window):
    def __init__(self):

        self.connect("delete_event", lambda a, b: gtk.main_quit())

        table = gtk.Table()

        city = gtk.Label("city: ")
        city.set_alignment(1.0, 0.5)
        ecity = gtk.Entry()

        lzip = gtk.Label("zip code: ")
        lzip.set_alignment(1, 0.5)
        ezip = gtk.Entry()


Sandro Dentella  *:-)
e-mail: sandro a e-den.it 
http://www.tksql.org                    TkSQL Home page - My GPL work

More information about the pygtk mailing list