Hi everyone!
I am using PyGTK and the gtk.Assistant. On one page I have placed a treeview (one column, just strings) in a gtk.ScrolledWindow (I wanted the vertical scrollbar, since the list contains about 35 items). Everything is working fine; the only thing that bugs me is that I have not been able to figure out from the documentation how to set the size of the scrolled window. Currently only three items are displayed at a time; I would like to set this number to 10 or so.
Below is the code. As you can see I have tried using a gtk.Adjustment to influence the scrolled window's size, but as - once more - I have been incompetent at retrieving the required info from the documentation, I don't actually know what values should be put into there.
self.page7 = gtk.VBox()
# The gtk.Adjustment:
page_size = gtk.Adjustment(lower=10, page_size=100) # just used some arbitrary numbers here >_<
scrolled_win = gtk.ScrolledWindow(page_size)
scrolled_win.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) # only display scroll bars when required
self.character_traits_treeview = gtk.TreeView()
self.character_traits_treestore = gtk.TreeStore(str)
self.character_traits_treeview.set_model(self.character_traits_treestore)
tc = gtk.TreeViewColumn("Character traits")
self.character_traits_treeview.append_column(tc)
cr = gtk.CellRendererText()
tc.pack_start(cr, True)
tc.add_attribute(cr, "text", 0)
self.character_trait_selection = self.character_traits_treeview.get_selection()
self.character_trait_selection.connect('changed', self.check_number_of_character_trait_selections)
self.character_trait_selection.set_mode(gtk.SELECTION_MULTIPLE)
self.make_character_traits_treestore()
# adding the treeview to the scrolled window:
scrolled_win.add(self.character_traits_treeview)
self.page7.pack_start(scrolled_win, False, False, 0)
self.assistant.append_page(self.page7)
self.assistant.set_page_title(self.page7, "Step 7: Select 2-3 character traits")
self.assistant.set_page_type(self.page7, gtk.ASSISTANT_PAGE_CONTENT)
self.assistant.set_page_complete(self.page7, False)
def check_number_of_character_trait_selections(self, blah):
# ...
def make_character_traits_treestore(self):
# ...
I know I should RTFM, but as I can't make head or tail of it, and as further searching, too, has been to no avail, I'm just hoping that someone on here can give me a hint.
Thanks a lot in advance!
PS: Here are the links to:
the gtk.ScrolledWindow documentation
the gtk.Adjustment documentation