On 2003-02-23, Grzegorz Adam Hankiewicz <[EMAIL PROTECTED]> wrote:
> I have a VBox which contains a few buttons and a TreeView. For
> the buttons I call set_border_width(), but this doesn't have any
> effect on the TreeView.

I'm attaching an example which demonstrates this, built up from John
Finlay's tutorial and pygtk's demo (for the TreeView part). The
expected behaviour of the example is to display a button and a
list with three items with the same spacing, but the border of the
TreeView stays invariable. Is this a bug? Is this a feature?

I'm using Python 2.2.1 and PyGTK from CVS.
#!/usr/bin/env python

import gtk, gobject

class Test_window:

   def clicked_button1(self, widget):
      print "Button pressed"

   def delete_event(self, widget, event, data = None):
      return 0

   def __init__(self):
      # create the new window
      self.window = window = gtk.Window(gtk.WINDOW_TOPLEVEL)
      window.set_title("Welcome window")
      window.set_border_width(10)

      # delete handler to exit GTK
      window.connect("delete_event", self.delete_event)
      window.connect('destroy', lambda w: gtk.main_quit())

      # create a box to package interface elements inside
      self.box1 = box1 = gtk.VBox(0, 0)
      window.add(box1)

      # create a button
      self.button1 = button1 = gtk.Button("Create")
      box1.pack_start(button1, 1, 1, 0)
      button1.connect("clicked", self.clicked_button1)
      button1.set_border_width(5)
      button1.show()

      # create a list
      store = gtk.ListStore(gobject.TYPE_STRING)
      for entry in ["One item", "Anoter", "Oh, and this one"]:
         store.set(store.append(), 0, entry)

      self.list = list = gtk.TreeView(store)
      box1.pack_start(list)
      # the following line seems to be ignored
      list.set_border_width(50)
      list.set_rules_hint(1)
      list.set_headers_visible(0)

      column = gtk.TreeViewColumn('Description',
         gtk.CellRendererText(), text=0)
      list.append_column(column)
      list.show()

      # show elements
      box1.show()
      window.show()
      
if __name__ == '__main__':
   Test_window = Test_window()
   gtk.main()
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to