def gradient(): try: turtle.TurtleScreen._RUNNING = True w = turtle.Screen() w.title("Gradient") w.setup(700, 700) w.clear() t = turtle.Turtle() t.speed(0) t.hideturtle() #t.penup() #red = 255;green = 0; blue = 0 red = random.randint(0,255) green = random.randint(0,255) blue = random.randint(0,255) redHex = hexcon(red); greenHex = hexcon(green); blueHex = hexcon(blue) thecolor = "#"+redHex+greenHex+blueHex t.color(thecolor) t.penup() t.goto(0,200) t.pendown() style = ('Arial', 30, 'bold') t.write('Gradient', font=style, align='center') grad(t,red, green, blue) w.exitonclick() finally: turtle.Terminator()
def eye(x, y, penwidth, first, second, third): try: yeet = turtle.Turtle() turtle.tracer(0, 0) for i in range(45): #yeet.pencolor("red") yeet.penup() #if (yeet.pensize() != 5) yeet.pensize(5) yeet.goto(x, y) yeet.pendown() yeet.pencolor("red") yeet.width(penwidth) yeet.forward(first) #200 yeet.pencolor("green") yeet.left(100) yeet.forward(second) #160 yeet.pencolor("blue") yeet.right(80) yeet.forward(third) #30 yeet.right(70) yeet.penup() turtle.update() #yeet.pensize(1) finally: turtle.Terminator()
def main(): try: #Old main turtle.TurtleScreen._RUNNING = True #get width and height globally turtle.screensize(canvwidth=width, canvheight=height, bg=bgstring) print(turtle.Screen().screensize()) w = turtle.Screen() w = turtle.Screen() hello_world() border_line() border_line_2() border_line_3() border_line_4() border_line_5() border_line_6() #border_line_7() #border_line_8() polygon_1() polygon_2() polygon_3() polygon_4() polygon_5() circle_1() circle_2() #circle_3() #circle_4() #circle_5() finisher_red() w.exitonclick() #new main finally: turtle.Terminator()
def main(): try: turtle.TurtleScreen._RUNNING = True turtle.screensize(canvwidth=100, canvheight=100, bg=None) w = turtle.Screen() t = turtle.Turtle() circles(t) w.exitonclick() finally: turtle.Terminator()
def main(): try: turtle.TurtleScreen._RUNNING = True turtle.screensize(canvwidth=700, canvheight=700, bg=None) print(turtle.Screen().screensize()) w = turtle.Screen() drawing(t) w.exitonclick() finally: turtle.Terminator()
def main(): try: turtle.TurtleScreen._RUNNING = True # get wdth and hgth globally print(turtle.Screen().screensize()) w = turtle.Screen() t = turtle.Turtle() t.hideturtle() grid(t) plotCircles(t) w.exitonclick() finally: turtle.Terminator()
def main(): try: turtle.TurtleScreen._RUNNING = True # get wdth and hgth globally turtle.screensize(canvwidth=wdth, canvheight=hgth, bg=bgstring) print(turtle.Screen().screensize()) w = turtle.Screen() t = turtle.Turtle() t.hideturtle() grid(t) plotCircles(t) w.exitonclick() finally: turtle.Terminator()
def turtle1(): try: turtle.TurtleScreen._RUNNING = True x = 0; y = 0 w = turtle.Screen() w.setup(800, 700) w.title("Welcome to the turtle zoo!") w.clear() w.bgcolor("#ffffff") w.visible = True t = turtle.Turtle() circle(t,x,y) w.exitonclick() finally: turtle.Terminator()
def get_mouse_click_coor2(x, y): #this is da main try: mouseposx = x mouseposy = y cordprint = (str(x) + ", " + str(y)) print('"eye" at: ' + cordprint) #debug turtle.hideturtle() #need.rectangle_filled(x, y, random.randint(10,100), random.randint(10,100), menu_color) #ec.eye(x, y, random.randint(0, 2), random.randint(100, 120), random.randint(50, 100),random.randint(10, 50), menu_color) sm.star(x, y, random.randint(20, 50)) print(str(menu_color)) need.text(x, y, cordprint, menu_color, 8, "") #debug turtle.penup() finally: turtle.Terminator()
def ulam(): vector = [-1,0,90,180,180,270, \ 270,0,0,0,90, \ 90,90,180,180,180, \ 180,270,270,270,270, \ 0,0,0,0,0] x = -400 y = 0 try: turtle.TurtleScreen._RUNNING = True w = turtle.Screen() w.title("Ulam Spiral") w.setup(700, 700) w.clear() w.bgcolor("#fdf6e3") t = turtle.Turtle() t.penup() t.goto(0, 300) style = ('Arial', 30, 'bold') t.write('Ulam Spiral', font=style, align='center') t.penup() t.goto(0, 0) t.speed(0) t.pendown() for i in range(1, 26): prime = isprime(i) #print(prime) tcolor = "#268bd2" if ((prime == True) and (i > 1)): x, y = t.pos() x = int(x) y = int(y) #print(x,y) tcolor = "#859900" circler(t, x, y, 10, tcolor) t.goto(x, y) t.color(tcolor) t.dot() #t.circle(15) t.pendown() t.seth(vector[i]) tcolor = "#268bd2" t.color(tcolor) t.forward(30) w.exitonclick() #print("number",i," prime = " ,prime ) finally: turtle.Terminator()
def chaos(): try: turtle.TurtleScreen._RUNNING = True w = turtle.Screen() w.title("Chaos") w.clear() w.bgcolor("#FDF6E3") t = turtle.Turtle() t.ht()# hide turtle t.speed(0) t.penup() t.color("#50b3b3") t.goto(0,-300) style = ('Arial', 30, 'bold') t.write('Chaos - Sierpiński Triangle', font=style, align='center') t.color("#ffffff") t.width(1) h = randint(-10,10) # Calculate a starting point for x k = randint(-10,10) # Calculate a starting point for y c = "" alist =[h,k,c] # Assign the starting points to a list. count = 0 while True: alist = newpoint(alist) # Get a new point from a function that is half way between the current point and a random vertex of a triangle. x = alist[0] # Assign a new x value from the list alist[] to x y = alist[1] # Assign a new y value from the list alist[] to y theColor = alist[2] t.penup() t.goto(x, y) t.pendown() if (theColor == 0): cs = "#32DC7F" elif (theColor == 1): cs = "#7F32DC" else: cs = "#DC327F" t.color(cs) #32DC7F;#7F32DC;#DC327F; t.seth(90) #t.dot() t.fd(1) count = count + 1 if (count > 1000000): break #input("Press return to end") w.exitonclick() finally: turtle.Terminator()
def main(): try: turtle.tracer(2,0) turtle.TurtleScreen._RUNNING = True t = turtle.Turtle() screen = turtle.Screen() bob = 0 movie(t) clear(t) while (bob == 0): legs1(t) clear(t) legs2(t) clear(t) screen.exitonclick() finally: turtle.Terminator()
def main(): try: turtle.TurtleScreen._RUNNING = True w = turtle.Screen() w.clear() t = turtle.Turtle() t.speed(0) t.hideturtle() #t.penup() #red = 255;green = 0; blue = 0 red = random.randint(0, 255) green = random.randint(0, 255) blue = random.randint(0, 255) grad(t, red, green, blue) w.exitonclick() finally: turtle.Terminator()
def elipse(t,a,b): try: turtle.TurtleScreen._RUNNING = True t.penup() x = (a*-1); y = 0 t.goto(0,0) t.pendown() t.color("#00ff00") start = 1 while (x < (a+1)): y = ((b*b)*(1-((x*x)/(a*a))))**0.5 y = int(y) if(start == 1): t.penup() start = 0 else: t.pendown() t.goto(x,y) x = x + 1 start = 1 x = x - 1 t.penup() while (x > -1*a - 1): y = (((b*b)*(1-((x*x)/(a*a))))**0.5)*-1 y = int(y) if(start == 1): t.penup() start = 0 else: t.pendown() t.goto(x,y) x = x - 1 w.exitonclick() finally: turtle.Terminator() def callElipse(): w = turtle.Screen() w.clear() t = turtle.Turtle() a = 35; b = 70 t.width(4) elipse(t,a,b) a = 20; b = 40 t.width(4) elipse(t,a,b)
def callLeo(): try: turtle.TurtleScreen._RUNNING = True w = turtle.Screen() w.setup(700, 700) w.clear() w.title("three") w.bgcolor("#0000ff") t = turtle.Turtle() t.pendown() x = 100 y = 0 count = 0 t.width(10) t.color("#ffffff") t.circle(50) w.exitonclick() finally: turtle.Terminator()
def ringsv2(): try: turtle.TurtleScreen._RUNNING = True turtle.screensize(canvwidth=700, canvheight=700, bg=None) x = -30 y = 0 w = turtle.Screen() w.clear() w.bgcolor("#ffffff") t = turtle.Turtle() turtle.tracer(0, 0) #t.shape('classic') #t.hideturtle() #t.speed(0) t.penup() t.goto(0, 0) #t.speed(0) t.color("#000000") blackring(t) t.up() bluering(t) t.up() redring(t) t.up() yellowring(t) t.up() greenring(t) t.up() blueringfill(t) t.up() blackringfill1(t) t.up() blackringfill2(t) t.color('#ff00ff') t.up() redringfill(t) #t.hideturtle() turtle.update() w.exitonclick() finally: turtle.Terminator()
def callSpiral(): try: turtle.TurtleScreen._RUNNING = True w = turtle.Screen() w.title("Recursion") w.clear() w.bgcolor("#505050") t = turtle.Turtle() t.color("#FFEDBF") t.penup() t.goto(0,300) style = ('Arial', 30, 'bold') t.write('Recursion Example - Spiral', font=style, align='center') t.penup() t.goto(-100,250) t.pendown() drawSpiral(t,170,1) w.exitonclick() finally: turtle.Terminator()
def star(x, y, length): try: turtle.tracer(0, 0) need.penupsetxy(x - length / 2, y) for side in range(0, 5): if (side == 1): turtle.color("red") elif (side == 2): turtle.color("green") elif (side == 3): turtle.color("blue") elif (side == 4): turtle.color("red") elif (side == 5): turtle.color("green") turtle.forward(length) turtle.right(144) turtle.update() finally: turtle.Terminator()
def callElipse(): try: turtle.TurtleScreen._RUNNING = True w = turtle.Screen() w.title("Elipse") w.clear() t = turtle.Turtle() t.penup() t.color("#ff0000") t.goto(-200, 300) style = ('Arial', 30, 'bold') t.color("#ff3300") t.write('Elipse', font=style, align='left') t.goto(-200, 260) t.color("#ff7700") style = ('Arial', 14, 'bold') t.write('[TOP] y = ((b*b)*(1-((x*x)\/(a*a))))**0.5', font=style, align='left') t.goto(-200, 240) t.write('[BOTTOM] y = (((b*b)*(1-((x*x)\/(a*a))))**0.5)*-1', font=style, align='left') a = 35 b = 70 t.width(10) t.color("#0000dd") elipse(t, a, b) a = 27 b = 60 t.width(7) t.color("#0077dd") elipse(t, a, b) a = 17 b = 50 t.width(3.5) t.color("#00ffdd") elipse(t, a, b) w.exitonclick() finally: turtle.Terminator()
def kk(): turtle.home() turtle.pendown() righty = 45 turtle.setheading(random.randrange(0, 360)) for practicesquarerotation in range(1, 200): turtle.right(righty) turtle.forward(practicesquarerotation) print(practicesquarerotation) myxloc = turtle.xcor() if turtle.distance(0, 0) >= 200: turtle.home() practicesquarerotation = practicesquarerotation * -1 righty = righty * -1 if turtle.distance(200, -300) >= 300: mynewvar = myxloc * -1 turtle.circle(turtle.distance(0, 0) / 10) if turtle.distance(0, 0) >= 300: turtle.home() turtle.circle(turtle.distance(0, 0) / 100) if practicesquarerotation % 200 == 0: turtle.Terminator(True)
def bruh2(): try: pn.menucol("black") turtle.onscreenclick(pn.get_mouse_click_coor2) finally: turtle.Terminator()
def menucol(col): try: global menu_color menu_color = col finally: turtle.Terminator()
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. >>> import turtle >>> turtle.forward(100) >>> turtle.exitonclick() >>> import turtle >>> turtle.shape("turtle") Traceback (most recent call last): File "<pyshell#4>", line 1, in <module> turtle.shape("turtle") File "<string>", line 5, in shape turtle.Terminator >>> turtle.Terminator("turtle") Terminator('turtle') >>> turtle.forward(100) >>> turtle.left(90) >>> turtle.forward(100) >>> turtle.left(90) >>> turtle.forward(100) >>> turtle.left(90) >>> turtle.forward(100) >>> turtle.exitonclick() >>> turtle.exitonclick() Traceback (most recent call last): File "<pyshell#14>", line 1, in <module> turtle.exitonclick() File "<string>", line 5, in exitonclick turtle.Terminator >>> import SyntaxError: invalid syntax >>>
def turt(): try: turtle.TurtleScreen._RUNNING = True turtle.screensize(canvwidth=700, canvheight=700, bg=None) x = -400 y = 0 w = turtle.Screen() w.clear() w.bgcolor("#ffffff") t = turtle.Turtle() x = -400 y = 0 t.speed(0) t.penup() t.goto(0, 100) t.begin_fill() tcolor = "#00ff00" t.color(tcolor) arcR(t, x, y, 25, 11, 90) tcolor = "#00ff00" t.color(tcolor) arcR(t, x, y, 50, 45, 180) tcolor = "#00ff00" t.color(tcolor) arcR(t, x, y, 25, 11, 0) tcolor = "#00ff00" t.color(tcolor) arcR(t, x, y, 25, 45, 90) t.goto(260, -50) tcolor = "#00ff00" t.color(tcolor) arcR(t, x, y, 25, 45, 90) tcolor = "#00ff00" t.color(tcolor) arcR(t, x, y, 25, 11, 270) t.goto(145, -270) t.goto(140, -200) t.goto(135, -170) tcolor = "#00ff00" t.color(tcolor) arcR(t, x, y, 25, 11, 180) tcolor = "#00ff00" t.color(tcolor) arcR(t, x, y, 25, 45, 270) t.goto(0, 100) tcolor = "#00ff00" t.color(tcolor) arcR(t, x, y, 25, 45, 270) t.end_fill() t.penup() t.right(130) t.forward(250) t.right(90) t.forward(100) t.color("red") t.pendown() t.begin_fill() t.forward(10) t.circle(10) t.end_fill() t.penup() t.forward(30) t.color("red") t.pendown() t.begin_fill() t.forward(10) t.circle(10) t.end_fill() w.exitonclick() finally: turtle.Terminator()
elif int(x) == 6: art = smile elif int(x) == 7: art = cool else: art = kitty shape = input("What would you like the shape of each pixel to be?\n1) Square\n2) Triangle\n3) Circle\n > ") if int(shape) == 2: shape = 'triangle' elif int(shape) == 3: shape = 'circle' else: shape = 'square' screen() turtle.tracer(0, 0) pallet_1, pixels_1 = load_art(art) draw(pallet_1, pixels_1, shape) turtle.update() save_art = int(input("Would you like to save this image?\n1) Yes\n2) No\n > ")) if save_art == 1: save_image() turtle.Terminator() # Keeps image on screen set_persist = input("Would you like me to draw another image?\n1) Yes\n2) No\n > ") if int(set_persist) == 1: screen_reset(myPen) else: persist = False
def __init__(self): try: turtle.Terminator() except Exception as e: pass
def turtleClose(self): try: turtle.Terminator() except Exception as e: pass
def ganar(): import turtle import time t = turtle.Turtle() turtle.setup(1400, 750) t.speed(0) turtle.bgcolor("#000000") turtle.title("¡Felicidades!") t.shape("turtle") t.color("green", "green") t.pensize(5) t.pencolor("yellow") # t.bgcolor('lightyellow') #G t.forward(-500) t.left(90) t.forward(200) t.right(90) t.forward(100) t.forward(-100) t.left(90) t.forward(-200) t.right(90) t.forward(100) t.left(90) t.forward(100) t.right(90) t.forward(-50) #A t.forward(50) t.left(90) t.forward(-100) t.right(90) t.forward(50) t.left(80) t.forward(200) t.left(180) t.forward(100) t.left(100) t.forward(55) t.forward(-55) t.left(80) t.forward(100) t.right(150) t.forward(210) t.left(70) t.forward(50) #N t.forward(200) t.forward(-200) t.left(90) t.forward(200) t.left(30) t.forward(-230) t.right(30) t.forward(200) t.forward(-200) t.right(90) t.forward(500) t.forward(-450) #A t.left(80) t.forward(200) t.left(180) t.forward(100) t.left(100) t.forward(55) t.forward(-55) t.left(80) t.forward(100) t.right(150) t.forward(210) t.left(70) t.forward(50) #S t.forward(100) t.left(90) t.forward(100) t.left(90) t.forward(100) t.right(90) t.forward(100) t.right(90) t.forward(100) t.forward(-100) t.right(90) t.forward(100) t.left(90) t.forward(100) t.left(90) t.forward(-100) t.right(90) t.forward(100) #T t.left(90) t.forward(200) t.left(90) t.forward(50) t.forward(-100) t.forward(50) t.right(90) t.forward(-200) t.right(90) t.forward(100) #E t.forward(100) t.forward(-100) t.left(90) t.forward(200) t.right(90) t.forward(100) t.forward(-100) t.left(90) t.forward(-100) t.right(90) t.forward(50) t.forward(-50) t.left(90) t.forward(-100) t.right(90) t.forward(100) t.left(180) t.forward(500) t.left(90) t.forward(180) t.right(124) for i in range(35): t.forward(i * 10) t.right(144) time.sleep(5) turtle.bye() turtle.Terminator()
a = snake.xcor() b = snake.ycor() old_fruit[0].goto(a, b) snake_move() ##snake and border collision if snake.xcor() > 280 or snake.xcor() < -300 or snake.ycor( ) > 240 or snake.ycor() < -240: time.sleep(1) screen.clear() screen.bgcolor('turquoise') scoring.goto(0, 0) scoring.write(" GAME OVER \n Your Score is {}".format(score), align="center", font=("Courier", 30, "bold")) ## snake collision for food in old_fruit: if food.distance(snake) < 20: time.sleep(1) screen.clear() screen.bgcolor('turquoise') scoring.goto(0, 0) scoring.write(" GAME OVER \n Your Score is {}".format(score), align="center", font=("Courier", 30, "bold")) time.sleep(delay) turtle.Terminator()
def rainbowv2(): try: turtle.TurtleScreen._RUNNING = True turtle.screensize(canvwidth=700, canvheight=700, bg=None) x = -400 y = 0 w = turtle.Screen() w.clear() w.bgcolor("#ffffff") t = turtle.Turtle() x = -400 y = 0 t.speed(0) t.penup() t.goto(-400, -100) t.pendown() t.begin_fill() tcolor = "#ff0000" t.color(tcolor) arcR(t, x, y, 75, 11.25, 90) tcolor = "#ff0000" t.color(tcolor) arcR(t, x, y, 75, 11.25, 0) t.end_fill() t.penup() t.begin_fill() t.goto(-345, -100) tcolor = "#ffa500" t.color(tcolor) arcR(t, x, y, 65, 11.25, 90) tcolor = "#ffa500" t.color(tcolor) arcR(t, x, y, 65, 11.25, 0) t.end_fill() t.penup() t.begin_fill() t.goto(-285, -100) tcolor = "#ffff00" t.color(tcolor) arcR(t, x, y, 55, 11.25, 90) tcolor = "#ffff00" t.color(tcolor) arcR(t, x, y, 55, 11.25, 0) t.end_fill() t.penup() t.begin_fill() t.goto(-225, -100) tcolor = "#008000" t.color(tcolor) arcR(t, x, y, 45, 11.25, 90) tcolor = "#008000" t.color(tcolor) arcR(t, x, y, 45, 11.25, 0) t.end_fill() t.penup() t.begin_fill() t.goto(-165, -100) tcolor = "#0000ff" t.color(tcolor) arcR(t, x, y, 35, 11.25, 90) tcolor = "#0000ff" t.color(tcolor) arcR(t, x, y, 35, 11.25, 0) t.end_fill() t.penup() t.begin_fill() t.goto(-105, -100) tcolor = "#4b0082" t.color(tcolor) arcR(t, x, y, 25, 11.25, 90) tcolor = "#4b0082" t.color(tcolor) arcR(t, x, y, 25, 11.25, 0) t.end_fill() t.penup() t.begin_fill() t.goto(-45, -100) tcolor = "#8a2be2" t.color(tcolor) arcR(t, x, y, 15, 11.25, 90) tcolor = "#8a2be2" t.color(tcolor) arcR(t, x, y, 15, 11.25, 0) t.end_fill() t.penup() t.begin_fill() t.goto(15, -100) tcolor = "#ffffff" t.color(tcolor) arcR(t, x, y, 5, 11.25, 90) tcolor = "#ffffff" t.color(tcolor) arcR(t, x, y, 5, 11.25, 0) t.end_fill() t.hideturtle() w.exitonclick() finally: turtle.Terminator()