Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

[ LEAP MOTION + PYTHON ] Can anyone help me improve this python code so that it

ID: 3874711 • Letter: #

Question

[ LEAP MOTION + PYTHON ] Can anyone help me improve this python code so that it will run smoothly as expected? I am working on a project integrating a Leap Controller with a graphical user interface (GUI) using Python Tkinter. To get me started, I seek for an example code but then the sample code is kind of faulty since the tracking stops at certain frames. If you have the controller, please do try so that you can see what I am talking about here. MANY THANKS! :)

Explanation / Answer

from Tkinter import Frame, Canvas, YES, BOTH import Leap class TouchPointListener(Leap.Listener): def on_init(self, controller): print "Initialized" def on_connect(self, controller): print "Connected" def on_frame(self, controller): self.paintCanvas.delete("all") frame = controller.frame() interactionBox = frame.interaction_box for pointable in frame.pointables: normalizedPosition = interactionBox.normalize_point(pointable.tip_position) if(pointable.touch_distance > 0 and pointable.touch_zone != Leap.Pointable.ZONE_NONE): color = self.rgb_to_hex((0, 255 - 255 * pointable.touch_distance, 0)) elif(pointable.touch_distance
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote