p5
p5 copied to clipboard
Bug in reference/environment/cursor.py example
Test script:
This is the cursor.py example:
# put your test script here
from p5 import *
def draw():
if mouse_x < 180:
cursor('CROSS')
else:
cursor('HAND')
run()
Expected behavior:
Actual behavior
Errors produced (if any):
$ py37 cursor.py
WARNING: Traceback (most recent call last):
File "cursor.py", line 9, in <module>
run()
File "/home/mark/opt/python37/lib/python3.7/site-packages/p5/sketch/userspace.py", line 142, in run
app.run()
File "/home/mark/opt/python37/lib/python3.7/site-packages/vispy/app/_default_app.py", line 62, in run
return default_app.run()
File "/home/mark/opt/python37/lib/python3.7/site-packages/vispy/app/application.py", line 142, in run
return self._backend._vispy_run()
File "/home/mark/opt/python37/lib/python3.7/site-packages/vispy/app/backends/_glfw.py", line 194, in _vispy_run
self._vispy_process_events()
File "/home/mark/opt/python37/lib/python3.7/site-packages/vispy/app/backends/_glfw.py", line 183, in _vispy_process_events
timer._tick()
File "/home/mark/opt/python37/lib/python3.7/site-packages/vispy/app/backends/_glfw.py", line 516, in _tick
self._vispy_timer._timeout()
File "/home/mark/opt/python37/lib/python3.7/site-packages/vispy/app/timer.py", line 168, in _timeout
count=self.iter_count)
File "/home/mark/opt/python37/lib/python3.7/site-packages/vispy/util/event.py", line 455, in __call__
self._invoke_callback(cb, event)
File "/home/mark/opt/python37/lib/python3.7/site-packages/vispy/util/event.py", line 475, in _invoke_callback
self, cb_event=(cb, event))
<< caught exception here: >>
File "/home/mark/opt/python37/lib/python3.7/site-packages/vispy/util/event.py", line 471, in _invoke_callback
cb(event)
File "/home/mark/opt/python37/lib/python3.7/site-packages/p5/sketch/base.py", line 116, in on_timer
self.draw_method()
File "cursor.py", line 5, in draw
cursor('CROSS')
File "/home/mark/opt/python37/lib/python3.7/site-packages/p5/sketch/userspace.py", line 244, in cursor
raise NotImplementedError
NotImplementedError
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7f81ba28d4e0>> for Event
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7f81ba28d4e0>> repeat 2
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7f81ba28d4e0>> repeat 4
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7f81ba28d4e0>> repeat 8
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7f81ba28d4e0>> repeat 16
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7f81ba28d4e0>> repeat 32
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7f81ba28d4e0>> repeat 64
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7f81ba28d4e0>> repeat 128
p5 version: 0.4.0a1.dev2 Python version: 3.7.0 Operating System: Ubuntu 16.04.5 LTS (64-bit)
There seems to be a similar bug in no_cursor.py at the cursor('HAND') call.
Ah... the cursor code hasn't been ported over to vispy yet! That why it's raising the NotImplementedError
for most of them. I'll put a note in the documentation regarding this.