Question
Python 3.6 Make the following code draw a line while cursor is moving: Code: from turtle import * def switchupdown(x=0, y=0): if pen()[pendown]: end_fill() up()
Python 3.6
Make the following code draw a line while cursor is moving:
Code:
from turtle import *
def switchupdown(x=0, y=0): if pen()["pendown"]: end_fill() up() else: down() begin_fill()
def changecolor(x=0, y=0): global colors colors = colors[1:]+colors[:1] color(colors[0])
def main(): global colors shape("circle") resizemode("user") shapesize(.5) width(3) colors=["red", "green", "blue", "yellow"] color(colors[0]) switchupdown() onscreenclick(goto,1) onscreenclick(changecolor,2) onscreenclick(switchupdown,3) return "EVENTLOOP"
if __name__ == "__main__": msg = main() print(msg) mainloop()
from turtle import * def switchupdown(x-0, y-0): if penO[" pendown"']: end fill() up() else: down() begin_fill() def changecolor(x=0, y=0): global colors colors = colors[1:]-colors[:11 color(colors[0]) def main): global colors shape("circle") resizemode("user") shapesize(.5) width(3) colors-["red", "green", "blue", "yellow"] color(colors[0]) switchupdown() onscreenclick(goto,1) onscreenclick(changecolor,2) onscreenclick(switchupdown,3) return "EVENTLOOP" if_name_ --"_main_": msg main() print(msg) mainloop()Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started