colors = ["red", "orangered", "orange", "gold", "yellow",
"yellowgreen", "green", "darkgreen", "teal", "blue",
"darkblue", "indigo", "purple", "magenta"]
col_index = 0
color = colors[0]
def mouse_move():
x = stage.mouse_x()
y = stage.mouse_y()
new_square = codesters.Square(x, y, 25, color)
# add other actions...
stage.event_mouse_move(mouse_move)
def interval():
global col_index
global colors
global color
col_index = (col_index + 1)%len(colors)
color = colors[col_index]
stage.event_interval(interval, .01)
-
Run Code
-
-
Stop Running Code
-
Show Chart
-
Show Console
-
Codesters How To (opens in a new tab)