def fullscreen_toggler(window, event, keysym=gtk.keysyms.F11):
    if event.keyval == keysym:
        fullscreen = bool(gtk.gdk.WINDOW_STATE_FULLSCREEN & window.
            get_property('window-state'))
if fullscreen:
    window.unfullscreen()
else:
    window.fullscreen()
Simple way to toggle fullscreen with F11 in PyGTK