示例#1
0
    def draw_path(self, positions):
        '''
        Draws the path given by a position list
        '''

        def position_to_turtle(pos):
            '''Converts a maze position to a turtle position'''
            return (home_x + _DRAW_SIZE * pos[0], home_y - _DRAW_SIZE * pos[1])

        # Get maze size
        width, height = self.size

        # Prepare turtle
        home_x = (-(_DRAW_SIZE * width) / 2) + (_DRAW_SIZE / 2)
        home_y = ((_DRAW_SIZE * height) / 2) - (_DRAW_SIZE / 2)

        turtle.showturtle()
        turtle.pencolor(_DRAW_PATH)

        # Move to star
        turtle.penup()
        turtle.goto(home_x, home_y)
        turtle.pendown()

        # Draw the path
        for pos in positions:
            turtle.goto(position_to_turtle(pos))
def show_turtle(turtle, x):
    """Do you want to see the turtle?"""

    if show_turtle == 'yes':
        turtle.showturtle()
    else:
        turtle.hideturtle()
示例#3
0
def passeio(dim, lado, passos):    
    # Prepara grelha
    turtle.speed(0)
    grelha_2(dim,lado)
    turtle.color('red')
    turtle.home()
    turtle.pendown()
    # Passeio
    turtle.speed(6)
    turtle.dot()
    turtle.showturtle()
    lim_x = lim_y = (dim*lado)//2
    cor_x = 0
    cor_y = 0
    for i in range(passos):
        vai_para = random.choice(['N','E','S','W'])
        if (vai_para == 'N') and (cor_y < lim_y):
            cor_y += lado
            turtle.setheading(90)
            turtle.fd(lado)
        elif (vai_para == 'E') and (cor_x < lim_x):
            cor_x += lado
            turtle.setheading(0)
            turtle.fd(lado)
        elif (vai_para == 'S') and (cor_y > -lim_y):
            cor_y -= lado
            turtle.setheading(270)
            turtle.fd(lado)
        elif (vai_para == 'W') and (cor_x > -lim_x):
            cor_x -= lado
            turtle.setheading(180)
            turtle.fd(lado) 
        else:
            print((vai_para,turtle.xcor(),turtle.ycor()))
            continue
示例#4
0
def loop(x,y):
    if -50<x<50 and -5<y<45:
        turtle.clear()
        play()
    else:
        turtle.showturtle()
        turtle.goto(x, y)
示例#5
0
def rectangle(length, width, x = 0, y = 0, color = 'black', fill = False):
    import turtle
    turtle.showturtle()
    turtle.penup()
    turtle.goto(x,y)
    turtle.color(color)
    turtle.pendown()
    if fill == True:
        turtle.begin_fill()
        turtle.forward(length)
        turtle.left(90)
        turtle.forward(width)
        turtle.left(90)
        turtle.forward(length)
        turtle.left(90)
        turtle.forward(width)
        turtle.end_fill()
    else:
        turtle.forward(length)
        turtle.left(90)
        turtle.forward(width)
        turtle.left(90)
        turtle.forward(length)
        turtle.left(90)
        turtle.forward(width)
    turtle.hideturtle()
示例#6
0
文件: MyTurtle.py 项目: qrdean/py
 def writeText(x, y, text, color ='black'):
     turtle.showturtle()
     turtle.color(color)
     turtle.penup()
     turtle.goto(x + .05*abs(x),y + .05*abs(y))
     turtle.pendown()
     turtle.write(text)
     turtle.setheading(0)
示例#7
0
 def _goto_coor(self):
     loc = self.loc
     x_cor = self.x_cor
     y_cor = self.y_cor
     turtle = self.Turtle
     turtle.pu()
     turtle.goto(x_cor, y_cor)
     turtle.showturtle()
示例#8
0
def main():
    angles = [36, 144, 144, 144, 144]
    t.showturtle()
    
    for i in range(5):
        t.left(angles[i])
        t.forward(300)
        
    t.done()
示例#9
0
def init():
    turtle.setworldcoordinates(-WINDOW_WIDTH / 2, -WINDOW_WIDTH / 2,
                               WINDOW_WIDTH / 2, WINDOW_HEIGHT / 2)
    turtle.up()
    turtle.setheading(0)
    turtle.hideturtle()
    turtle.title('Snakes')
    turtle.showturtle()
    turtle.setx(-225)
    turtle.speed(0)
示例#10
0
def main():
    t.showturtle()
    pos = [[-45,0], [-45,-90], [45,0], [45,-90]]
    
    for i in range(4):
        t.penup()
        t.goto(pos[i])
        t.pendown()
        t.circle(45)
        
    t.done()
示例#11
0
def drawLine(x1, y1, x2, y2):
    turtle.showturtle()
    turtle.penup()
    # Point 1
    turtle.goto(x1, y1)
    turtle.pendown()
    turtle.write((x1,y1), font=('Calibri', 8))
    # Point 2
    turtle.goto(x2, y2)
    turtle.write((x2,y2), font=('Calibri', 8))
    turtle.hideturtle()
    turtle.done()
示例#12
0
def chessboard(side, xstart = 0, ystart = 0, color = 'black', background = 'white'):
    import turtle
    turtle.speed(50)
    turtle.showturtle()
    turtle.penup()
    turtle.goto(xstart, ystart)
    turtle.right(45)
    squareSize = side/8
    for i in range(1,9):
        oddoreven = i % 2
        if oddoreven == 1:
            for k in range(0,4):
                
                turtle.color(color)
                turtle.begin_fill()
                turtle.circle(squareSize, steps = 4)
                turtle.end_fill()
                turtle.left(45)
                turtle.forward(squareSize*1.45)
                turtle.color(background)
                turtle.begin_fill()
                turtle.right(45)
                turtle.circle(squareSize, steps = 4)
                turtle.end_fill()
                turtle.left(45)
                turtle.forward(squareSize*1.45)
                turtle.right(45)
        else:
            for k in range(0,4):
                
                turtle.color(background)
                turtle.begin_fill()
                turtle.circle(squareSize, steps = 4)
                turtle.end_fill()
                turtle.left(45)
                turtle.forward(squareSize*1.45)
                turtle.color(color)
                turtle.begin_fill()
                turtle.right(45)
                turtle.circle(squareSize, steps = 4)
                turtle.end_fill()
                turtle.left(45)
                turtle.forward(squareSize*1.45)
                turtle.right(45)
        turtle.penup()
        turtle.goto(xstart, ystart+squareSize*1.45*i)
        turtle.pendown()
    turtle.penup()
    turtle.goto(xstart,ystart)
    turtle.color('black')
    turtle.pensize(5)
    turtle.pendown()
    turtle.circle(side*1.01, steps = 4)
示例#13
0
def runSimulation(path, destination):
    turtle.up()
    turtle.delay(0)
    turtle.setposition(path[0].xloc, path[0].yloc)
    for node in path:
        turtle.pencolor("red")
        turtle.color("green", "orange")
        turtle.delay(100)
        turtle.showturtle()
        turtle.down()
        turtle.setposition(node.xloc, node.yloc) 
        drawRouter(node.label, node.xloc, node.yloc) 
        turtle.up()
    turtle.down()
示例#14
0
def init():
    """
    sets the width of window and initialise parameters
    :return:
    """

    t.setworldcoordinates(-WINDOW_WIDTH / 2, -WINDOW_WIDTH / 2,
                          WINDOW_WIDTH / 2, WINDOW_HEIGHT / 2)
    t.up()
    t.setheading(0)
    t.hideturtle()
    t.title('Forest')
    t.showturtle()
    t.setx(-225)
    t.speed(0)
示例#15
0
def main():
    turtle.showturtle()
    turtle.right(108)
    turtle.forward(100)
    turtle.right(216)
    turtle.forward(100)
    turtle.right(216)
    turtle.forward(100)
    turtle.right(216)
    turtle.forward(100)
    turtle.right(198)
    turtle.forward(00)
    turtle.right(18)
    turtle.forward(100)
    turtle.done()
示例#16
0
def parallelogram(s, color):#creates a single parallelogram
    turtle.showturtle()
    turtle.shape('turtle')
#    time.sleep(3)
    turtle.pensize(3)
    turtle.fillcolor(color)
    turtle.begin_fill()
    turtle.fd(s)
    turtle.left(45)
    turtle.fd(s)
    turtle.left(135)
    turtle.fd(s)
    turtle.left(45)
    turtle.fd(s)
    turtle.end_fill()
示例#17
0
文件: MyTurtle.py 项目: qrdean/py
 def circle(radius, cx = 0, cy = 0, color = 'black', fill = False, move = True):    
     turtle.showturtle()
     if move == True:
         turtle.penup()
         turtle.goto(cx,cy)
         turtle.pendown()
         turtle.color(color)
         if fill == True:
             turtle.begin_fill()
             turtle.circle(radius)
             turtle.end_fill()
         else:
             turtle.circle(radius)
     turtle.setheading(0)
     turtle.hideturtle()
示例#18
0
def drawStar(location_of_house, max_height, max_height_index, type_of_tree):
    """
    drawStar() position itself where star need to drawn and then draw star
    :param max_height: height of tallest tree
    :param max_height_index:  index of tallest tree
    :return: does not return anything
    """
    t.setposition(-225, 0)
    t.showturtle()
    t.up()

    if max_height_index <= location_of_house:
        for _ in range(1, max_height_index):
            t.forward(100)
    elif max_height_index > location_of_house:
        for _ in range(1, location_of_house):
            t.forward(100)
        t.forward(100)
        for _ in (location_of_house, max_height_index):
            t.forward(100)

    t.left(ANGLENINETY)
    if type_of_tree == 1:
        t.forward(max_height + (25 * math.tan(1.047)) + 35)
    elif type_of_tree == 2:
        t.forward(max_height + (90 / math.pi) + 35)
    elif type_of_tree == 3:
        t.forward(max_height + (30 * math.tan(1.047)) + 35)
    #t.forward(30)

    for _ in range(8):
        t.down()
        t.forward(25)
        t.right(ANGLENINETY * 2)
        t.up()
        t.forward(25)
        t.right(ANGLENINETY * 2)
        t.right((ANGLENINETY * 4) / 8)

    t.right(ANGLENINETY * 2)
    if type_of_tree == 1:
        t.forward(max_height + (25 * math.tan(1.047)) + 75)
    elif type_of_tree == 2:
        t.forward(max_height + (90 / math.pi) + 75)
    elif type_of_tree == 3:
        t.forward(max_height + (30 * math.tan(1.047)) + 75)
    #t.forward(30)
    t.left(ANGLENINETY)
示例#19
0
def saveDrawing():
    # hide turtle
    turtle.hideturtle()
    # generate unique file name
    dateStr = (datetime.now()).strftime("%d%b%Y-%H%M%S")
    fileName = 'spiro-' + dateStr 
    print('saving drawing to %s.eps/png' % fileName)
    # get tkinter canvas
    canvas = turtle.getcanvas()
    # save postscipt image
    canvas.postscript(file = fileName + '.eps')
    # use PIL to convert to PNG
    img = Image.open(fileName + '.eps')
    img.save(fileName + '.png', 'png')
    # show turtle
    turtle.showturtle()
示例#20
0
文件: forest.py 项目: wish343/Python
def init_for_day():
    """
    Initialize for drawing in the day. (-WINDOW_WIDTH/2, -WINDOW_HEIGHT/2) is in
    the lower left and(WINDOW_WIDTH/2, WINDOW_HEIGHT/2) is in the
    upper right.
    : pre: (relative) pos (0,0), heading (east), up
    : post:(relative) pos (-500,-333.33), heading (east), up
     heading (east), up
    : return: None
    """
    turtle.up()
    turtle.hideturtle()
    turtle.setx(-WINDOW_WIDTH/2)
    turtle.sety(-WINDOW_HEIGHT/3)
    turtle.setheading(0)
    turtle.showturtle()
示例#21
0
def drawThreeCircles(turtle,ofs,rad):
    turtle.color('black', 'white')     #give mao turtle black trace and white fill
    turtle.speed(0)                    #give mao turtle maximum speed
    
    turtle.showturtle()
    
    turtle.pensize(3)
    turtle.penup()
    turtle.goto(0,ofs)
    turtle.pendown()
    turtle.begin_fill()
    for i1 in range(0,361):
        turtle.forward((2.0 * math.pi * rad) / 360.0)
        turtle.right(1.0)
    
    turtle.end_fill()
    turtle.hideturtle()
示例#22
0
文件: forest.py 项目: wish343/Python
def init():
    """
    Initialize for drawing in the night. (-WINDOW_WIDTH/2, -WINDOW_HEIGHT/2) is in
    the lower left and(WINDOW_WIDTH/2, WINDOW_HEIGHT/2) is in the
    upper right.
    : pre: (relative) pos (0,0), heading (east), down
    : post:(relative) pos (-333.33,0), heading (east), up
    : return: None
    """

    turtle.setworldcoordinates(-WINDOW_WIDTH / 2, -WINDOW_HEIGHT / 2,
                               WINDOW_WIDTH / 2, WINDOW_HEIGHT / 2)
    turtle.up()
    turtle.hideturtle()
    turtle.setx(-WINDOW_WIDTH / 3)
    #turtle.setheading(0)
    turtle.showturtle()
示例#23
0
def polygon(side, numberSides, angle = 0, xstart = 0, ystart = 0, color = 'black', fill = False):
    import turtle
    totDegree = (numberSides - 2) * 180
    new = totDegree / numberSides
    degree = 180-new
    turtle.showturtle()
    turtle.penup()
    turtle.goto(xstart, ystart)
    turtle.color(color)
    turtle.pendown()
    turtle.right(angle)
    turtle.forward(side)
    if fill == True:
        turtle.begin_fill()
        for i in range(1,numberSides):
            turtle.left(degree)
            turtle.forward(side)
        turtle.end_fill()
    else:
        for i in range(1,numberSides):
            turtle.left(degree)
            turtle.forward(side)
    turtle.hideturtle()
示例#24
0
def main():
    space = Room(-150,-150,300,260, "")
    room1 = Room(-150, 10, 100,100, "bed room")
    room2 = Room(70, -150, 80,80, "game room")
    room3 = Room(80,60, 70,50,"bath room")
    
    table1 = Table(-80, -100, 4, 60, 50, 'red')
    table2 = Table(-90, -40, 6, 25, 0, 'blue')
    
    sofa1 = Sofa(50, 0, 30, 40, 'yellow')
    sofa2 = Sofa(0,-70, 30, 80, 'green')
    
    turtle.showturtle()
    space.show()
    room1.show()
    room2.show()
    room3.show()
    
    table1.show()
    table2.show()
    sofa1.show()
    sofa2.show()
    turtle.done()
示例#25
0
def Drawcircle():

    turtle.showturtle()
    turtle.circle(50)
示例#26
0
文件: main.py 项目: PISANKINA/pr4
from ufo import *
import turtle as tr
import random

tr.tracer(0)
tr.hideturtle()
tr.bgcolor('blue')

colors = ['green', 'blue', 'pink', 'orange', 'red', 'black', 'brown', 'yellow']
lst_ufo = []
tr.showturtle()
response = tr.numinput('Ответ', 'Введите желаемое кол-во тарелок:')
if response == None:
    pass
else:
    for i in range(int(response)):
        lst_ufo.append(
            Ufo('Пришелец-' + str(i), random.randint(-600, 600),
                random.randint(-600, 600), random.randint(30, 300),
                colors[random.randint(0, 7)], random.randint(3, 10),
                random.randint(2, 8)))

while True:
    for i in range(len(lst_ufo)):
        lst_ufo[i].show()
        lst_ufo[i].move()
    tr.update()
    tr.clear()

    tr.listen()
示例#27
0
def main():
    turtle.showturtle()
    Drawsquare(100)
def tscheme_showturtle():
    """Make turtle visible."""
    _tscheme_prep()
    turtle.showturtle()
示例#29
0
# CTI-110
# P4T1b: Initials
# Adam Lancaster
# 4/1/20
#

import turtle                           # import turtle package.
turtle.showturtle()                     # display the turtle.
turtle.speed(0)                         # set speed of turtle.
turtle.setup(800, 350)                  # set window to fit image.
turtle.pencolor('yellow')               # set line color.
turtle.pensize(5)                       # adjust line width.
turtle.bgcolor('green')                 # set background color.

turtle.penup()                          # move from point to point to make the 
turtle.goto(-350, -100)                 # letter "A".
turtle.pendown()
turtle.goto(-250, 100)
turtle.goto(-200, 0)
turtle.goto(-300, 0)
turtle.goto(-200, 0)
turtle.goto(-150, -100)
turtle.penup()

turtle.goto(-100, 100)                  # move from point to point to make the
turtle.pendown()                        # letter "T".
turtle.goto(100, 100)
turtle.goto(0, 100)
turtle.goto(0, -100)
turtle.penup()
def boy_(turtle, X, Y, img):
    wn.addshape(img)
    turtle.shape(img)
    turtle.up()
    turtle.goto(X, Y)
    turtle.showturtle()
def tscm_showturtle():
    """Make turtle visible."""
    _tscm_prep()
    turtle.showturtle()
    return UNSPEC
示例#32
0
import turtle  # 导入turtle

turtle.showturtle()  # 显示箭头
turtle.width(10)  # 调整画笔粗细
turtle.color("blue")
turtle.circle(30)  # 画半径为100的圆
turtle.penup()  # 抬笔
turtle.goto(80, 0)  # 去坐标(0,50)
turtle.pendown()  # 下笔
turtle.color("black")  # 调整画笔颜色
turtle.circle(30)  # 画半径为100的圆
turtle.penup()  # 抬笔
turtle.goto(160, 0)  # 去坐标(0,50)
turtle.pendown()  # 下笔
turtle.color("red")
turtle.circle(30)  # 画半径为100的圆
turtle.penup()  # 抬笔
turtle.goto(40, -30)  # 去坐标(0,50)
turtle.color("yellow")
turtle.pendown()  # 下笔
turtle.circle(30)  # 画半径为100的圆
turtle.penup()  # 抬笔
turtle.goto(120, -30)  # 去坐标(0,50)
turtle.color("green")
turtle.pendown()  # 下笔
turtle.circle(30)  # 画半径为100的圆

# print("猜数字游戏!")
# temp = input("请输入数字:") #输入函数
# guess = random.randint(1, 10)
# while int(temp) != guess:
示例#33
0
文件: app.py 项目: wuhuqifei/git
def move_pen_position(x, y):
    turtle.hideturtle()
    turtle.up()
    turtle.goto(x, y)
    turtle.down()
    turtle.showturtle()
示例#34
0
Chung Yuan Christian University
written by Woody Lo (the teaching assistant of Python Course_Summer Camp.)
'''
import turtle

# Simultaneous assignment, using prompt for inputing two points
x1, y1 = eval(input("Enter x1 and y1 for the 1st point: ")
              )  # Take the user input as interprets code.
x2, y2 = eval(input("Enter x2 and y2 for the 2nd point: ")
              )  # Take the user input as interprets code.

# Compute the distance
distance = ((x1 - x2)**2 + (y1 - y2)**2)**0.5

# Display two points and the connecting line.
turtle.showturtle()  # Open the window (default size is 400x400).
turtle.penup()  # Take the pen up.
turtle.goto(x1, y1)  # Go to (x1, y1) = (User-Input, User-Input).
turtle.pendown()  # Put the pen down. So we can draw.
turtle.color("blue")  # Change to "blue" color for pen.
turtle.write(
    "1st Point",
    font=14)  # Write the "1st Point" text on canvas with 14 font size.
turtle.color("black")  # Change to "black" color for pen.
turtle.goto(x2, y2)  # Go to (x2, y2) = (User-Input, User-Input).
turtle.color("blue")  # Change to "blue" color for pen.
turtle.write(
    "2nd Point",
    font=14)  # Write the "2nd Point" text on canvas with 14 font size.
turtle.penup()  # Take the pen up.
示例#35
0
Python 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license()" for more information.
>>> import turtle # Import turtle module
>>> turtle.showturtle()
>>> turtle.write("Haha, ugly turtle.")
>>> turtle.forward(80)
>>> turtle.left(45)
>>> turtle.forward(100)
>>> turtle.color('pink')
>>> turtle.goto(0, 50)
>>> turtle.penup()
>>> turtle.goto(50, -50)
>>> turtle.pendown()
>>> turtle.circle(150)
>>> turtle.goto(0.0)
Traceback (most recent call last):
  File "<pyshell#12>", line 1, in <module>
    turtle.goto(0.0)
  File "<string>", line 8, in goto
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/turtle.py", line 1774, in goto
    self._goto(Vec2D(*x))
TypeError: type object argument after * must be an iterable, not float
>>> turtle.penup()
>>> turtle.goto(0, 0)
>>> turtle.goto(0, -50)
>>> turtle.color('blue')
>>> turtle.circle()
Traceback (most recent call last):
  File "<pyshell#17>", line 1, in <module>
    turtle.circle()
示例#36
0
import turtle
import time
#str = input('请输入表白语:')
str = "爱你哦!"
turtle.speed(10)  #画笔速度
turtle.setup(1800, 700, 70, 70)
turtle.color('black', 'pink')  # 画笔颜色
turtle.pensize(3)  # 画笔粗细
turtle.hideturtle()  # 隐藏画笔(先)
turtle.up()  # 提笔
turtle.goto(-655, -255)  # 移动画笔到指定起始坐标(窗口中心为0,0)
turtle.down()  #下笔
turtle.showturtle()  #显示画笔
#画左边的小人
turtle.goto(-600, -200)
turtle.goto(-600, -120)
turtle.circle(35)
turtle.goto(-600, -200)
turtle.forward(40)
turtle.right(90)
turtle.forward(60)
turtle.hideturtle()
turtle.up()
turtle.goto(-600, -160)
turtle.down()
turtle.showturtle()
turtle.left(90)
turtle.forward(55)
turtle.right(45)
turtle.forward(20)
turtle.hideturtle()
示例#37
0
def drawGrid ():
    turtle.showturtle()
    turtle.speed(0)
    print ("Drawing grid...")
    for i in range(ST_AVE):
        turtle.draw
示例#38
0
#goto


import turtle
turtle.showturtle()
turtle.color('red')

for i in range(4):
    turtle.forward(30)
    turtle.goto((30 * (i + 1)), (i+1)*30)


turtle.goto(0,0)
示例#39
0
def drawGrid():
    turtle.showturtle()
    turtle.speed(0)
    drawHorizontal()
    drawVertical()
    drawFireStation()
示例#40
0
# -*- coding: utf-8 -*-
import turtle as t
'''设置'''
t.setup(800, 500)  # 创建画布并使其位于屏幕中心
t.pensize(2)  #  画笔粗细
t.colormode(255)  # 色彩模式
t.speed(5)  # 绘画速度
t.color('black', (255, 228, 181))  # 画笔颜色与填充色
t.shape('turtle')  # 画笔的形状
t.speed(5)  #画笔速度
t.showturtle()  # 使画笔显现
# 头
t.pu()
t.goto(-150, 10)
t.pd()
t.seth(0)
t.begin_fill()
t.left(135)
t.circle(-70, 85)
t.right(8)
t.circle(-85, 44)
t.left(10)
t.circle(40, 61)
t.right(15)
t.fd(20)
t.right(5)
t.circle(-40, 45)
t.left(6)
t.circle(-70, 25)
t.left(18)
t.circle(-80, 35)
示例#41
0
    move_robot(2)


def key_r():
    move_robot(3)


def key_e():
    list_clear()


t.setup(600, 600)
s = t.Screen()
t.hideturtle()

t.addshape(robot_fn)
t.shape(robot_fn)
t.speed(6)
t.penup()
clicked(-265, 265)
t.goto(-265, 265)
t.showturtle()

s.onkey(key_SP, "space")
s.onkey(key_BS, "BackSpace")
s.onkey(key_s, "s")
s.onkey(key_r, "r")
s.onkey(key_e, "e")
s.onscreenclick(clicked)
s.listen()
示例#42
0
'''

import math, turtle
x1,y1,width,height = eval(input("Enter the center of rectangle, width and height"))

l = abs(x1) - width
w = abs(y1) - height

if l == 0:
    l = width // 2
elif w == 0:
    w = height // 2

l = abs(l)
w = abs(w)
turtle.showturtle()
turtle.penup()
turtle.goto(x1,y1)
turtle.forward(l)
turtle.pendown()
turtle.setheading(-90)
turtle.forward(w)
turtle.setheading(180)
turtle.forward(2 * l)
turtle.setheading(90)
turtle.forward(2 * w)
turtle.setheading(0)
turtle.forward(2 * l)
turtle.setheading(-90)
turtle.forward(w)
turtle.done()
def move_pen_position(x, y):
    turtle.hideturtle()  # 隐藏画笔
    turtle.up()  # 提笔
    turtle.goto(x, y)  # 移动画笔到指定起始坐标(窗口中心为0,0)
    turtle.down()  # 下笔
    turtle.showturtle()  # 显示画笔
示例#44
0
'''2.24 (Turtle: draw four hexagons) Write a program that draws four hexagons in the
         center of the screen.


/**
 * @author BASSAM FARAMAWI
 * @email [email protected]
 * @since 2018
 */
'''
import turtle  # Import turtle module

side = 30  # The hexagon side size

turtle.showturtle()  # Show the turtle graphics window

# 1'st hexagon
turtle.left(30)
turtle.forward(side)
turtle.left(60)
turtle.forward(side)
turtle.left(60)
turtle.forward(side)
turtle.left(60)
turtle.forward(side)
turtle.left(60)
turtle.forward(side)
turtle.left(60)
turtle.forward(side)
turtle.penup()
示例#45
0
import turtle as t
t.hideturtle()
t.penup()
#t.setx(-300)
#t.sety(-300)
p = t.Pen()
p.reset()
p.speed(22)
t.showturtle()
t.pendown()

def koch(t, order, size, myangle):
    if order == 0:
        t.forward(size)
        t.left(myangle)
    else:
        for angle in [60, -60, -60, 60, 0]:
           koch(t, order-1, size/3, angle/2)
           t.left(angle)

#p.up()
koch(t, 3, 500, 60)
a = raw_input()

示例#46
0
import turtle as tu
for i in range(0, 999999999999999999, 1):
    tu.color('red')
    tu.speed(20000)
    tu.pensize(3)
    tu.showturtle()
    tu.forward(72)
    tu.left(175)
    tu.forward(56)
    tu.right(90)
    tu.forward(47)
    tu.right(90)
    tu.forward(69)
    tu.left(135)
    tu.forward(41)
    tu.right(30)
    tu.forward(51)
示例#47
0
def tscheme_showturtle():
    """Make turtle visible."""
    _tscheme_prep()
    turtle.showturtle()
示例#48
0
import turtle
'''
turtle.screensize(3024,2768)#屏幕
turtle.write("hello天朝",font=("华文琥珀",20,"normal"))#设定字体大小
turtle.showturtle()#显示
turtle.circle(100,steps=2000)
turtle.done()
'''

turtle.screensize(3024, 2768)  #屏幕
turtle.write("hello天朝", font=("华文琥珀", 20, "normal"))  #设定字体大小
turtle.showturtle()  #显示

turtle.begin_fill()  #开始填充
turtle.circle(100, steps=5)
turtle.color("blue")  #变色
turtle.end_fill()  #结束填充

turtle.reset()  #重置

turtle.pensize(20)  #画笔变粗
turtle.begin_fill()  #开始填充
turtle.circle(100, steps=4)
turtle.color("yellow")  #变色
turtle.end_fill()  #结束填充
turtle.hideturtle()  #隐藏箭头

turtle.done()