当前位置: 首页>>代码示例>>Python>>正文


Python turtle.speed函数代码示例

本文整理汇总了Python中turtle.speed函数的典型用法代码示例。如果您正苦于以下问题:Python speed函数的具体用法?Python speed怎么用?Python speed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了speed函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: turtle_init

def turtle_init():
	turtle.ht()
	turtle.up()
	turtle.speed(0)
	turtle.left(90)
	turtle.backward(350)
	turtle.down()
开发者ID:TravisWhitaker,项目名称:lsystems,代码行数:7,代码来源:stupid_tree.py

示例2: draw_starrows

def draw_starrows(row):
    color2 = 1
    color = get_color(color2)
    x = -160
    y = 150
    ## This for loop draws 10 stars for each row above (5 total x 10 = 50).
    for z in range(10):
        x += 15
        turtle.up()
        turtle.color(color)
        turtle.speed(100)
        turtle.setpos(x,row)
        turtle.begin_fill()
        turtle.down()
        turtle.forward(6.154)
        turtle.left(144)
        turtle.forward(6.154)
        turtle.left(144)
        turtle.forward(6.154)
        turtle.left(144)
        turtle.forward(6.154)
        turtle.left(144)
        turtle.forward(6.154)
        turtle.left(144)
        turtle.end_fill()
开发者ID:majeedus,项目名称:Python-Projects,代码行数:25,代码来源:america.py

示例3: draw_walk

def draw_walk(x, y, speed = 'slowest', scale = 20):
    ''' Animate a two-dimensional random walk.

    Args:
        x       x positions
        y       y positions
        speed   speed of the animation
        scale   scale of the drawing
    '''
    # Reset the turtle.
    turtle.reset()
    turtle.speed(speed)

    # Combine the x and y coordinates.
    walk = zip(x * scale, y * scale)
    start = next(walk)

    # Move the turtle to the starting point.
    turtle.penup()
    turtle.goto(*start)

    # Draw the random walk.
    turtle.pendown()
    for _x, _y in walk:
        turtle.goto(_x, _y)
开发者ID:AhmedHamedTN,项目名称:2015-python,代码行数:25,代码来源:random_walk.py

示例4: __init__

    def __init__(self, length=10, angle=90, colors=None, lsystem=None):
        import turtle
        self.length = length
        self.angle = angle
        if colors is None:
            self.colors = ['red', 'green', 'blue', 'orange', 'yellow', 'brown']
        if lsystem is not None:
            self.lsystem(lsystem)

        # draw number
        self.ith_draw = 0

        # origin of next draw
        self.origin = [0, 0]

        # bounding_box
        self._box = 0, 0, 0, 0


        # turtle head north and positive angles is clockwise
        turtle.mode('world')
        turtle.setheading(90)
        turtle.speed(0) # fastest
        turtle.hideturtle()
        turtle.tracer(0, 1)
	
        # set pencolor
        self.pencolor()
开发者ID:masterzu,项目名称:pylsys,代码行数:28,代码来源:pylsys.py

示例5: rectangle

def rectangle(length = 50, width = 30, x = 0, y = 0, color = 'black', fill = False):
    turtle.pensize(3)
    turtle.speed('fastest')
    turtle.hideturtle()
    if fill == True:
        turtle.color(color)
        for i in range(width): 
            turtle.setposition(x, (y+i))
            turtle.pendown()
            turtle.setposition((x+length), (y+i))
            turtle.penup()
    else:
        turtle.penup()
        turtle.goto(x,y)
        turtle.color(color)
        turtle.pendown()
        turtle.forward(length)
        turtle.left(90)
        turtle.forward(width)
        turtle.left(90)
        turtle.forward(length)
        turtle.left(90)
        turtle.forward(width)
        turtle.left(90)
        turtle.penup()

    return
开发者ID:JakenHerman,项目名称:python-homework,代码行数:27,代码来源:GraphicsAndPatternLibrary.py

示例6: main

def main():
    while True:
        side = input("Please enter the total length of the figure: ")
        try:
            side = int(side)
        except:
            print('Please enter a valid number.\n')
            continue
        break

    while True:
        id = input("Please enter MSU ID (including the starting letter): ")
        if len(id) == 9 and id[0].isalpha() and all(d.isdigit() for d in id[1:]):
            break
        else:
            print('Please enter a valid MSU ID.\n')
            continue

    turtle.colormode(1.0)
    turtle.speed(0)

    drawQ1(id, side/2)
    drawQ2(id, side/2)
    drawQ3(id, side/2)
    drawQ4(id, side/2)

    time.sleep(20)
    turtle.bye()
开发者ID:GriffinMartin,项目名称:CSE231,代码行数:28,代码来源:proj11.py

示例7: init_turtle

def init_turtle():
    """
    Стартовые настройки для рисования
    """
    turtle.colormode(255)
    turtle.speed(10)
    turtle.pensize(3)
开发者ID:eppel81,项目名称:education,代码行数:7,代码来源:charts_app.py

示例8: polygon

def polygon(side = 50, angle = None, xstart = None, ystart = None, numberSides = 3, color = 'black', fill = False):
    turtle.pensize(3)
    turtle.speed('fastest')
    turtle.hideturtle()
    if angle != None:
        turtle.left(angle)
    
    turtle.penup()
    if fill == True:
        if xstart != None or ystart != None:
            turtle.goto(xstart, ystart)
        else:
            turtle.goto(0, 0)
        turtle.color(color)
        turtle.pendown()
        turtle.begin_fill()
        turtle.circle(side, 360, numberSides)
        turtle.end_fill()
        turtle.penup()
        
    else:
        turtle.goto(xstart, ystart)
        turtle.color(color)
        turtle.pendown()
        turtle.circle(side, 360, numberSides)
        turtle.penup()
    
    return
开发者ID:JakenHerman,项目名称:python-homework,代码行数:28,代码来源:GraphicsAndPatternLibrary.py

示例9: tree1

def tree1(argv, x, y):
	lsys_filename1 = argv[1]
	lsys1 = ls.createLsystemFromFile( lsys_filename1 )
	print lsys1
	num_iter1 = int( 3 )
	dist = float( 5 )
	angle1 = float( 22 )
	
	s1 = ls.buildString( lsys1, num_iter1 )
	
	#draw lsystem1
	'''this is my first lsystem
		with filename mysystem1.txt
		with 3 iterations and
		with angle = 45 dist = 10'''
	turtle.tracer(False)
	turtle.speed(50000000)
	turtle.up()
	turtle.goto(0,0)
	turtle.goto(x, y)
	turtle.down()
	turtle.pencolor('White')
	it.drawString( s1, dist, angle1 )
	
	# wait and update
	turtle.update()
开发者ID:akaralekas,项目名称:cs151-colby,代码行数:26,代码来源:project7extension.py

示例10: turtleProgram

def turtleProgram():
    import turtle
    import random
    global length
    turtle.title("CPSC 1301 Assignment 4 MBowen") #Makes the title of the graphic box
    turtle.speed(0) #Makes the turtle go rather fast
    for x in range(1,(numHex+1)): #For loop for creating the hexagons, and filling them up
        turtle.color(random.random(),random.random(),random.random()) #Defines a random color
        turtle.begin_fill()
        turtle.forward(length)
        turtle.left(60)
        turtle.forward(length)
        turtle.left(60)
        turtle.forward(length)
        turtle.left(60)
        turtle.forward(length)
        turtle.left(60)
        turtle.forward(length)
        turtle.left(60)
        turtle.forward(length)
        turtle.left(60)
        turtle.end_fill()
        turtle.left(2160/(numHex))
        length = length - (length/numHex) #Shrinks the hexagons by a small ratio in order to create a more impressive shape
    turtle.penup()   
    turtle.goto(5*length1/2, 0) #Sends turtle to a blank spot
    turtle.color("Black")
    turtle.hideturtle()
    turtle.write("You have drawn %d hexagons in this pattern." %numHex) #Captions the turtle graphic
    turtle.mainloop()
开发者ID:trsman44,项目名称:Fall-2015,代码行数:30,代码来源:MatthewBowenA4.py

示例11: draw_flower

def draw_flower():
    window = turtle.Screen()
    window.bgcolor('blue')

    bobie = turtle.Turtle()
    turtle.speed('0')
    bobie.shape('classic')
    bobie.color('pink')

    anny = turtle.Turtle()
    anny.color('pink')

    for i in range(1,73):
        bobie.forward(100)
        bobie.right(30)
        bobie.forward(100)
        bobie.right(150)
        bobie.forward(100)
        bobie.right(30)
        bobie.forward(100)
        bobie.right(5)

    anny.right(90)
    anny.forward(300)



    window.exitonclick
开发者ID:wangyi0101,项目名称:full-stack,代码行数:28,代码来源:drawing_shape.py

示例12: __init__

    def __init__(self):
        # Janela sobre
        self.janSobre = None


        # Cor de fundo
        self.corFundo = "gray"


        turtle.screensize(1000, 700, self.corFundo)
        turtle.setup(width=1000, height=700)
        turtle.title("cidadeBela - Janela de desenho")


        turtle.speed(0)
        turtle.tracer(4)

        # Definindo variáveis globais
        self._tamPadrao = ""

        # Listas de prédios
        self.predios = ['Casa', 'Hotel']
        self.prediosProc = [ 'hotel', 'hotelInv', 'casa', 'casaInv' ]


        # Sorteando elementos
        self.sorteioPredios    = [["casa", 1], ["hotel", 1]]
        self.sorteioPrediosInv = [["casaInv", 1], ["hotelInv", 1]]


        #  Cores dos prédios
        self.coresHotel = ["076080190", "255255255", "167064057", "153204255", "000090245",
                           "201232098", "255058123", "010056150", "130255255", "255255000",
                           "255000000", "255127042", "000255000", "255170255", "000255170",
                           "212000255", "170255127", "127212255", "255127127", "255212085",
                           "212212255", "255255127", "222202144" ]
        self.coresCasa  = ['209187103', '115155225', '130047006', '255137111', '203229057',
                           '017130100', '025195159', '204057065', '194082255', '092221159',
                           '167045055', '238243030', '069241248', '000156228', '159094040',
                           '048033253', '040209239', '138164253', '190042177', '000122159',
                           '255255255', '253208201', '245228133']
        self.coresLoja  = ['255255255', '253208201', '245228133' ]

        #  Janelas dos prédios
        self.janelasHotel = janelas.janelasHotel
        self.janelasCasa  = janelas.janelasCasa
        self.janelasLoja  = janelas.janelasLoja
        self.janelasTodas = janelas.janelasTodas

        #  Tetos dos prédios
        self.tetosHotel = tetos.tetosHotel
        self.tetosCasa  = tetos.tetosCasa
        self.tetosLoja  = tetos.tetosLoja
        self.tetosTodas = tetos.tetosTodas

        #  Portas dos prédios
        self.portasHotel = portas.portasHotel
        self.portasCasa  = portas.portasCasa
        self.portasLoja  = portas.portasLoja
        self.portasTodas = portas.portasTodas
开发者ID:SrMouraSilva,项目名称:Academic-Projects,代码行数:60,代码来源:cb.py

示例13: turtlePrint

def turtlePrint(board, width, height):
    turtle.hideturtle()
    turtle.speed(0)
    turtle.penup()
    turtle.goto(-210, -60)
    turtle.pendown()
    turtle.goto(20*width-210, -60)
    turtle.goto(20*width-210, 20*height-60)
    turtle.goto(-210, 20*height-60)
    turtle.goto(-210, -60)
    turtle.penup()

    for y in xrange(height):
        for x in xrange(width):
            turtle.penup()
            turtle.goto(20*x-200,20*y-50)
            turtle.pendown()
            if board[x][y] is 1:
                turtle.pencolor("green")
                turtle.dot(10)
                turtle.pencolor("black")
            elif board[x][y] is 2:
                turtle.dot(20)
            elif board[x][y] is 3:
                turtle.pencolor("red")
                turtle.dot(10)
                turtle.pencolor("black")
            elif board[x][y] is 8:
                turtle.pencolor("blue")
                turtle.dot()
                turtle.pencolor("black")

    turtle.exitonclick()
开发者ID:mrton,项目名称:A_Star,代码行数:33,代码来源:A_Star.py

示例14: plot

	def plot(self, node1, node2, debug=False):
		"""Plots wires and intersection points with python turtle"""
		tu.setup(width=800, height=800, startx=0, starty=0)
		tu.setworldcoordinates(-self.lav, -self.lav, self.sample_dimension+self.lav, self.sample_dimension+self.lav)
		tu.speed(0)
		tu.hideturtle()
		for i in self.index:
			if debug:
				time.sleep(2)   # Debug only
			tu.penup()
			tu.goto(self.startcoords[i][0], self.startcoords[i][1])
			tu.pendown()
			tu.goto(self.endcoords[i][0], self.endcoords[i][1])
		tu.penup()
		if self.list_of_nodes is None:
			intersect = self.intersections(noprint=True)
		else:
			intersect = self.list_of_nodes
		tu.goto(intersect[node1][0], intersect[node1][1])
		tu.dot(10, "blue")
		tu.goto(intersect[node2][0], intersect[node2][1])
		tu.dot(10, "blue")
		for i in intersect:
			tu.goto(i[0], i[1])
			tu.dot(4, "red")
		tu.done()
		return "Plot complete"
开发者ID:jzmnd,项目名称:nw-network-model,代码行数:27,代码来源:nwnet.py

示例15: main

def main():
    path_data = open('path.txt').read()
    
    print turtle.position()
    turtle.penup()
    turtle.setposition(-400,200)
    turtle.pendown()
    turtle.speed(0)
    turtle.delay(0)
    for c in path_data:
        if c in 'NSEW*':
            if c == 'N':
                turtle.setheading(90)
                turtle.forward(1)
            if c == 'S':
                turtle.setheading(270)
                turtle.forward(1)
            if c == 'E':
                turtle.setheading(0)
                turtle.forward(1)
            if c == 'W':
                turtle.setheading(180)
                turtle.forward(1)
            if c == '*':
                if turtle.isdown():
                    turtle.penup()
                else:
                    turtle.pendown()
开发者ID:llnz,项目名称:kiwipycon2014codewars,代码行数:28,代码来源:q4.py


注:本文中的turtle.speed函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。