Pen Tablet reacts slowly
Andre Schmeißer
schmeisser at iupr.org
Fri Nov 23 10:50:32 EST 2007
Maybe I'm mistaken and it does produce click events by now, but when I
tested it
the first time it didn't. But if it did, the paint activity would
automatically work with
the pen tablet, as it doesn't need to distinguish it from regular
touchpad input, imo. If
there's click and drag just draw a line (or whatever).
The app I'm working on however (see my original post) only reacts on PT
input so
that the user is able to use the regular touchpad seperately from this.
It uses
gtk.Widget.set_extension_events(gtk.gdk.EXTENSION_EVENTS_ALL)
to receive events from the PT and checks the source device by comparing
| gtk.gdk.MOTION_NOTIFY.|device.name
with the name of the PT device.
The behavior I get is not ideal, though. As described there is a
noticeable delay
to the reaction. Also, the input seems to be jagged. The later is not
really a
problem, but just seems weird.
It would be nice if you could verify that behavior on your machine.
I attached a small python sample which simply draws lines between event
coordinates. I get smooth lines using the regular touchpad and jagged ones
with the PT. The inital delay is noticeable without any further tools,
just press
shortly on the tablet to let the mouse jump.
Thanks,
Andre Schmeisser
----------------- Python code -----------------
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
class EventWindow:
def __init__(self):
self.last_x = self.last_y = -1
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.set_title("Tablet Event Visualization")
self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
self.window.connect("destroy", lambda w: gtk.main_quit())
self.area = gtk.DrawingArea()
self.area.set_size_request(1200, 800)
self.window.add(self.area)
self.area.set_events(gtk.gdk.POINTER_MOTION_MASK )
#self.area.set_extension_events(gtk.gdk.EXTENSION_EVENTS_ALL)
self.area.connect("motion-notify-event", self.motion_notify)
self.area.show()
self.window.show()
self.style = self.area.get_style()
self.gc = self.style.fg_gc[gtk.STATE_NORMAL]
return
def motion_notify(self, area, event):
#print event.device.name + ':', event.x_root, event.y_root
self.gc.set_rgb_fg_color(gtk.gdk.Color(0,0,0))
self.area.window.draw_line(self.gc,
int(self.last_x),
int(self.last_y),
int(event.x_root),
int(event.y_root))
self.last_x, self.last_y = event.x_root, event.y_root
self.last_event = event.get_time()
return True
if __name__ == "__main__":
win = EventWindow()
gtk.main()
More information about the Devel
mailing list