Open main menu
Home
Random
Log in
Settings
About Sugar Labs
Disclaimers
Sugar Labs
Search
Changes
← Older edit
Development Team/Almanac
(view source)
Revision as of 18:28, 15 August 2012
555 bytes added
,
18:28, 15 August 2012
→How do I detect when one of the game buttons on the laptop have been pressed?
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? ===
Walter
Bureaucrats
,
Administrators
10,579
edits