Update example script

This commit is contained in:
iabdalkader 2014-02-11 01:48:54 +02:00
parent ebd51256f7
commit 4c2545fddf

View File

@ -22,9 +22,13 @@ def image2pixbuf(buff):
arr = arr.reshape((120, 160, 3)) arr = arr.reshape((120, 160, 3))
return gtk.gdk.pixbuf_new_from_array(arr, gtk.gdk.COLORSPACE_RGB, 8) return gtk.gdk.pixbuf_new_from_array(arr, gtk.gdk.COLORSPACE_RGB, 8)
ex_source = '''from openmv import sensor ex_source =\
'''from openmv import sensor, imlib
while (True): while (True):
image = sensor.snapshot()''' sensor.snapshot()
r= imlib.detect_color((340, 50, 50), 10)
imlib.draw_rectangle(r)
'''
class OMVGtk: class OMVGtk:
def __init__(self): def __init__(self):
@ -68,7 +72,7 @@ class OMVGtk:
buf = self.buffer.get_text(self.buffer.get_start_iter(), self.buffer.get_end_iter()) buf = self.buffer.get_text(self.buffer.get_start_iter(), self.buffer.get_end_iter())
# interrupt any running code # interrupt any running code
self.terminal.feed_child("\x03") self.terminal.feed_child("\x03")
sleep(0.1)
# exec script # exec script
openmv.exec_script(buf) openmv.exec_script(buf)