Interactive lessons
Contents:
k.Point: A position as an answer: the learner drags a point, andcorrect=(x, y)withtolerance=grades it.
Methods in this area:
s.ask: Stops playback for a question; the learner answers in the lesson player (or inkinemo dev).s.answer: An answer the scene uses before its question is asked: the learner moves a slider (or drags a point) and the frame follows.
Back to the reference index.
k.Point (class)#
k.Point(default: tuple[float, float] = (0.0, 0.0))
A position as an answer: the learner drags a point, and correct=(x, y) with tolerance= grades it. As a scene parameter, --param target=1,2.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
default |
tuple[float, float] |
(0.0, 0.0) |
k.Point(default=(0, 0)): a position in scene units; as a lesson's answer, a point the learner drags. |
Example:
@k.scene
def peak(s: k.Scene):
pick = s.answer(k.Point(default=(0, 0)))
dot = k.Dot(position=pick, r=0.15)
s.add(dot)
q = s.ask("Drag the dot to (2, 1)", pick, correct=(2, 1), tolerance=0.3)
with q.correct():
s.play(dot.to(fill=k.GREEN))
Members:
validate: Accept(x, y)or"x,y"from the command line.
k.Point.validate (method)
point.validate(v: object) -> object
Accept (x, y) or "x,y" from the command line.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
v |
object |
required |