home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / doc / python-gnome2-desktop / examples / wnck_example.py < prev   
Encoding:
Python Source  |  2009-03-14  |  961 b   |  27 lines

  1. import pygtk
  2. pygtk.require('2.0')
  3. import gtk
  4.  
  5. import wnck
  6.  
  7. def main():
  8.     screen = wnck.screen_get_default()
  9.     # Process pending gtk+ events so that wnck can find out about existing windows.
  10.     while gtk.events_pending():
  11.         gtk.main_iteration()
  12.     for window in screen.get_windows():
  13.         for window in screen.get_windows():
  14.             # A XID is a number that identifies a X window.
  15.             xid = window.get_xid()
  16.             # By calling gtk.gdk.window_foreign_new(xid), we are creating
  17.             # a gtk.gdk.Window which wraps the window that is identified by
  18.             # the XID. It will return None if it can't find the X window
  19.             # identified by the XID in question.
  20.             wrapped_window = gtk.gdk.window_foreign_new(xid)
  21.             # We are maximizing the window here, but
  22.             # you can do almost anything with a gtk.gdk.Window.
  23.             wrapped_window.maximize()
  24.  
  25. if __name__ == '__main__':
  26.     main()
  27.