| Issue 114: | Problem in running pyMT example | |
| 1 person starred this issue and may be notified of changes. | Back to list |
This is the CODE i am working on as an example
#!/usr/bin/env python
from pymt import *
#a dictionary/hash map to store touch positions
touch_positions = {}
#A widget that will draw a circle for each touch
class TestWidget(MTWidget):
#these functions handle the touch events
def on_touch_down(self, touches, touchID, x, y):
touch_positions[touchID] = (x,y)
def on_touch_move(self, touches, touchID, x, y):
touch_positions[touchID] = (x,y)
def on_touch_up(self, touches, touchID, x, y):
del touch_positions[touchID]
#at each frame, the draw method draws the widget
def draw(self):
set_color(1,0,0)
for position in touch_positions.values():
drawCircle(position, radius = 40)
#create a window and add our widget to it
win = MTWindow()
widget = TestWidget()
win.add_widget(widget)
#run the program
runTouchApp()
This is the error which I have been getting
Traceback (most recent call last):
File "C:\Python26\Python-1.py", line 24, in <module>
runTouchApp()
File "C:\Python26\lib\site-packages\pymt\mtpyglet.py", line 265, in
runTouchApp
pymt_evloop.run()
File "C:\Python26\lib\site-packages\pyglet\app\win32.py", line 63, in run
self._timer_func(0, 0, timer, 0)
File "C:\Python26\lib\site-packages\pyglet\app\win32.py", line 84, in
_timer_func
sleep_time = self.idle()
File "C:\Python26\lib\site-packages\pymt\mtpyglet.py", line 153, in idle
self.dispatch_input()
File "C:\Python26\lib\site-packages\pymt\mtpyglet.py", line 143, in
dispatch_input
self.post_dispatch_input(type=type, touch=touch)
File "C:\Python26\lib\site-packages\pymt\mtpyglet.py", line 90, in
post_dispatch_input
listener.dispatch_event('on_touch_down', touch)
File "C:\Python26\lib\site-packages\pyglet\window\__init__.py", line
1217, in dispatch_event
EventDispatcher.dispatch_event(self, *args)
File "C:\Python26\lib\site-packages\pyglet\event.py", line 352, in
dispatch_event
event_type, args, getattr(self, event_type))
File "C:\Python26\lib\site-packages\pyglet\event.py", line 349, in
dispatch_event
getattr(self, event_type)(*args)
File "C:\Python26\lib\site-packages\pymt\ui\window.py", line 321, in
on_touch_down
if w.dispatch_event('on_touch_down', touch):
File "C:\Python26\lib\site-packages\pymt\ui\widgets\widget.py", line 345,
in dispatch_event
event_type, args, getattr(self, event_type))
File "C:\Python26\lib\site-packages\pyglet\event.py", line 397, in
_raise_dispatch_exception
(event_type, len(args), descr))
TypeError: on_touch_down event was dispatched with 1 arguments, but handler
on_touch_down at C:\Python26\Python-1.py:8 has an incompatible function
signature
Nov 30, 2009
Project Member
#1
txprog
Status:
WontFix
|