I read this code in codeskulptor3
import simplegui
message = "Welcome!"
def click():
global message
message = "Good job!"
def draw(canvas):
canvas.draw_text(message, [50,112], 48, "Red")
frame = simplegui.create_frame("Home", 300, 200)
frame.add_button("Click me", click)
frame.set_draw_handler(draw)
frame.start()
I don't understand why the function draw
is being passed to set_draw_handler
without any argument (it should take a canvas object). But I don't see any canvas object. Who pass it?