On Tue, Aug 18, 2009 at 03:44:08PM +0200, Pietro Battiston wrote: > Il giorno lun, 03/08/2009 alle 20.57 -0700, John Finlay ha scritto: > > On 08/03/2009 01:27 PM, Alessandro Dentella wrote: > > > Hi > > > > > > I have a table with many widgets inside, so that total dimenstions are > > > bigger that the screen so that I put it in a ScrolledWindow + ViewPort. > > > > > > So far so good. ow I have a Window with all widgets in a pane that > > > scrolls > > > fine... but starts very little indeed. > > > > > > I'd like to know how to propagate the dimentions that the table would > > > have requested to set dimentions of the Viewport. > > > > > > I'm a little lost between size_request/get_child_requisition and > > > similar > > > methds. > > > > > > > > If the table is larger than the screen then I would assume you want the > > window to be smaller than the table. I usually set the default size of > > the Window so it starts up bigger than the minimum size. > > Right. Though several days passed, I'd like to signal that a deeper > answer is that pygtk (and Gtk in general) doesn't know/care about the > available size of the screen. More info can be found on the discussion > following this mail: > > http://mail.gnome.org/archives/gtk-devel-list/2009-January/msg00057.html > > Though horrible non-portable hacks are indeed possible, the clean > "solution" is to: > - set reasonable defaults
what is a "reasonable default"? It's just a height/width calculated on the screen the user is using. I don't think you can find any better value. > - remember user-defined resizes across program runs That doesn't helpl when I want to guess the best "starting" window dimention. Really there was another mail - mistakenly sent to John Finlay that answerd me- that I report here: Thanks John, I'd like to set it no greater than really needed. Now I query the table with size_request(), but if I set dimentions -possibly reduced- on the Viewport (or SrolledWidow) with set_size_request(x,y) that would inhibit the possibility for a user to further reduce it, and set_default_size() only work on window... My workaround is to: 1. get the size_request of the table 2. derive a best macth, based on screen dimentions and size_request 3. understand how many pixels are needed by non ViewPort staff around it 4. set_default_size() on the window so that the user can still interact with it and refine it Of course I could simplify all this process if I could 1. set size_request() on the Viewport/ScrolledWidow 2. set a parameter that says: you can resize At the end I don't understand why size_request of the table inserted in the ViewPort is not forwarded upward to it's container (the ViewPort). sandro *:-) -- Sandro Dentella *:-) http://sqlkit.argolinux.org SQLkit home page - PyGTK/python/sqlalchemy _______________________________________________ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/