Pen Tablet Support/GTK Widget
This GTK widget is intended for applications that want to map tablet input to an on-screen widget that is the same shape and aspect ratio as the physical tablet. At its largest size, this would take up the full width of the screen and approximately 1/3 of the height of the screen.
Note: As of April 12, 2008, this is being developed in Patrick Dubroy's git branch at
Using this widget is as simple as:
from sugar.graphics.tabletarea import TabletArea tablet_area = TabletArea()
This will create a gtk.DrawingArea on-screen. Whenever a stroke is detected on the tablet, a corresponding stroke will appear inside the widget. Some useful API:
# Returns a list of strokes that have been made inside the tablet area tablet_area.get_strokes() # Returns a copy of the gtk.gdk.Pixmap displayed on the tablet area tablet_area.get_pixmap() # Clears the tablet area -- both the pixmap and the list of strokes. tablet_area.clear()
Full API documentation (subject to change) can be found here.
 Sample Activity
For more information, please see the sample activity: source is in
NB: because the driver support for the Pen Tablet is still in flux, this activity forks an evtest process to read input from the tablet. It assumes that /dev/input/event5 is the tablet, which may not be the case on every XO. This hack will not be necessary in the future. So in order for the activity to work, you will either need to run it as root, or make the evtest executable setuid. This can be done from a terminal window using the following commands:
su - cd <activity_dir> chown root:olpc evtest chmod 4775 evtest
In addition, it can sometimes leave zombie processes lying around, which can be cured like so:
If anyone has a system where the tablet driver works properly (which I've heard is the case in the latest joyride builds), I welcome a patch to get this activity working with that.