Il giorno dom, 07/03/2010 alle 09.00 +0100, Osmo Maatta ha scritto: > Re-hello, > > Yes, your code works fine. > But the following code fails. > The "self.attuale" print 0 for every loop. > > # Again: This works only with Metacity or similar WM. > import gtk, gobject, wnck > import time > > class Cambiatore(object): > def __init__(self): > self.screen= wnck.screen_get_default() > > def cambia(self, next_ws): > ws = self.screen.get_workspaces()[next_ws] > ws.activate(0) > > ws = self.screen.get_active_workspace() > actual = self.screen.get_workspace_index(ws) > print "self.attuale=", actual > > gtk.main_quit() > > c = Cambiatore() > for i in range(4): > gobject.idle_add(c.cambia, i) > gtk.main() > #gobject.timeout_add_seconds(1, c.cambia) > > Why on earth we have to deal with event-loops to read or set desktop > values.
That's a nice question... Pietro > I should absolutely send a bomb to Wnck's mailing list! > > // Moma > > > On 03/06/2010 08:28 PM, Pietro Battiston wrote: > > http://lists.gulp.linux.it/pipermail/gulp/2009-September/035843.html > > > > That's in Italian, but I guess the code logic is quite understandable... > > and works (you can verify by adding a print). > > > > If I recall correctly, I too at the time had problems that had to do > > with the gtk main loop not running. > > > > cheers > > > > Pietro > > _______________________________________________ > 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/
