Changes

Jump to navigation Jump to search
Line 377: Line 377:  
</pre>
 
</pre>
    +
== How do I know if the screen has been rotated? ==
 +
 +
When the screen is rotated, GTK issues a CONFIGURE event. Test for this event and grab the screen dimensions in the event handler.
 +
 +
        self.window.add_events(gtk.gdk.CONFIGURE)
 +
        self.window.connect('configure-event', self._configure_cb)
 +
 +
    def _configure_cb(self, win, event):
 +
        width = gtk.gdk.screen_width()
 +
        height = gtk.gdk.screen_height()
 +
 +
This does not tell you the orientation, however. Allegedly on the XO hardware, you can use olpc-kbdshim (currently undocumented).
    
=== How do I detect if one of the joystick buttons has been pressed? ===
 
=== How do I detect if one of the joystick buttons has been pressed? ===

Navigation menu