Il giorno lun, 15/02/2010 alle 21.38 +0100, Matthias Geier ha scritto: > Dear list! > > My question may sound silly (and maybe it is), but let me explain. > You could say that a ScrolledWindow that is exactly as big as its > content doesn't make a lot of sense, but I think in my case it does:
http://www.daa.com.au/pipermail/pygtk/2009-August/017372.html and following. Also see the linked gtk-devel thread. But in your case (a kiosk), isn't http://www.pygtk.org/docs/pygtk/class-gtkwindow.html#method-gtkwindow--maximize enough?! Or even fullscreen?! Pietro > > I made a GUI using Glade and want to show it in a kind of "kiosk > mode", i.e. I want to run it in fullscreen mode with all the widgets > centered on the screen. > To achieve this, I placed a gtk.Alignment into the main gtk.Window and > inside of this I put all my other widgets. > This worked well until I placed a gtk.ScrolledWindow somewhere inside. > > The reason for this is that I wanted to run the GUI on different > screen resolutions. On large screens, the Scrolledwindow should show > all contents and on small screens there should be scrollbars. > > Therefore, I couldn't set a size request to the ScrolledWindow, > because this would be either too large for small screens or the other > way round. > > What do I have to do that the ScrolledWindow shows all its contents on > large screens but still is scrollable if the toplevel window is very > small? > > I think this should be logically possible, but I don't know how to > achieve it with pygtk. > > To illustrate my problem, I created a little test script (see below). > The buttons are of course only place-holders for my actual widgets. > In a comment there is one line with a size request. If I un-comment > that, it looks more or less like I want it to look. The thing is even > if I did know the exact size of the contents, it would still not be > scrollable if the window is made very small. > > I hope you understand my problem and maybe you know a solution or have > some hints for me. > > Thanks in advance, > Matthias > > ######################################### > #!/usr/bin/env python > > import pygtk > pygtk.require('2.0') > import gtk > > class ScrolledWindowTest: > def destroy(self, widget): > gtk.main_quit() > > def __init__(self): > window = gtk.Window() > window.fullscreen() > window.connect("destroy", self.destroy) > window.set_title("ScrolledWindow Test") > scrolled_window = gtk.ScrolledWindow() > # I would like it to look like with this line: > #scrolled_window.set_size_request(105,205) > scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) > alignment = gtk.Alignment(0.5, 0.5, 0, 0) > alignment.add(scrolled_window) > window.add(alignment) > vbox = gtk.VBox() > scrolled_window.add_with_viewport(vbox) > for i in range(5): > button = gtk.ToggleButton("button") > button.set_size_request(80, 40) > vbox.pack_start(button, expand=False) > window.show_all() > > if __name__ == "__main__": > ScrolledWindowTest() > gtk.main() > > ######################################### > _______________________________________________ > pygtk mailing list [email protected] > http://www.daa.com.au/mailman/listinfo/pygtk > Read the PyGTK FAQ: http://faq.pygtk.org/ _______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
