• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python turtle.down函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: drawCircle

def drawCircle(x, y, r):
    turtle.up()
    turtle.setpos(x+r,y)
    turtle.down()
    for i in range(0, DEGREES_IN_CIRCLE):
        a = math.radians(i+1)
        turtle.setpos(x+r*math.cos(a), y+r*math.sin(a))
开发者ID:marcleal,项目名称:python,代码行数:7,代码来源:Spiro.py


示例2: choix_position

	def choix_position(self):
		#position aléatoire dans l'écran
		self.x = random.randint(-350, 350)
		self.y = random.randint(-350, 350)
		tt.up()
		tt.goto(self.x, self.y)
		tt.down()
开发者ID:mseyne,项目名称:curriculum,代码行数:7,代码来源:7_1_ex.py


示例3: ejes

def ejes():
    ####################################
    # Ejes Coordenados                 #
    # los ejes x e y van de -150 a 150 #
    ####################################
    turtle.delay(0)
    turtle.ht()
    turtle.speed(0)
    turtle.pencolor('red')
    turtle.down()
    turtle.fd(301)
    turtle.rt(90)
    turtle.fd(1)
    turtle.rt(90)
    turtle.fd(300)
    turtle.lt(90)
    turtle.fd(300)
    turtle.rt(90)
    turtle.fd(1)
    turtle.rt(90)
    turtle.fd(300)
    turtle.lt(90)
    turtle.fd(300)
    turtle.rt(90)
    turtle.fd(1)
    turtle.rt(90)
    turtle.fd(300)
    turtle.lt(90)
    turtle.fd(300)
    turtle.rt(90)
    turtle.fd(1)
    turtle.rt(90)
    turtle.fd(300)
    turtle.up()
    turtle.pencolor('blue')
开发者ID:AlvaroSacari,项目名称:primitivas-CAD,代码行数:35,代码来源:ventana.py


示例4: drawHouse

def drawHouse(wallSize):

    """
    This is the function for drawing house which takes
    wall size as a input.
    :pre: (relative) pos (0,0), heading (east), right
    :post: (relative) pos (wallSize,0), heading (north), up
    :return: total wood required to built the house.
    """
    turtle.down()
    turtle.forward(wallSize)
    turtle.left(90)
    turtle.forward(wallSize)
    maxX = turtle.xcor()
    turtle.left(45)
    turtle.forward(wallSize / math.sqrt(2))
    maxY = turtle.ycor()
    turtle.left(90)
    turtle.forward(wallSize / math.sqrt(2))
    turtle.left(45)
    turtle.forward(wallSize)
    turtle.left(90)
    turtle.forward(wallSize)
    turtle.up()
    return 2 * (wallSize + wallSize / math.sqrt(2))
开发者ID:RIT-2015,项目名称:CPS,代码行数:25,代码来源:new_draw.py


示例5: draw_leaf

def draw_leaf(no_of_leafs):
    """
    Draws leafs at the end of branch. Min 0 and max = no_of_leafs
    :pre: pos(0,0), heading east, up
    :post: pos(0,0), heading east, up
    :param no_of_leafs: maximum number of leads drawn
    :return: None
    """
    for i in range(no_of_leafs):
        # draws random poylgon from triangle to hexagon
        sides = random.randint(3, 6)
        color = random.choice(COLORS)
        size = 10
        angle = 360/sides
        t.left(90 - i * angle)
        t.right(90)
        t.begin_fill()
        t.down()
        t.color(color)
        for _ in range(sides):
            t.forward(size)
            t.left(angle)
        t.left(90)
        t.up()
        t.end_fill()
        t.right(90 - i * angle)

    global LEAF_COUNTER
    LEAF_COUNTER += 1
开发者ID:AnushaBalusu,项目名称:PythonCodes,代码行数:29,代码来源:enhanced_tree.py


示例6: questionMark

def questionMark():
    """ Draw a question mark.
    """
    scale = int(input("scale, integer please"))
    
    turtle.forward( 10 *scale)
    turtle.down()
    turtle.left( 90 )
    turtle.forward( 2 *scale)
    turtle.up()
    turtle.forward( 3 *scale)
    turtle.down()
    turtle.forward( 5 *scale)
    turtle.right( 90 )
    turtle.forward( 10 *scale)
    turtle.left( 90 )
    turtle.forward( 10 *scale)
    turtle.left( 90 )
    turtle.forward( 20 *scale)
    turtle.left( 90 )
    turtle.forward( 5 *scale)
    turtle.up()
    turtle.forward( 15 *scale)
    turtle.left( 90 )
    turtle.forward ( 30 *scale)
开发者ID:jonobrien,项目名称:School_Backups,代码行数:25,代码来源:letter_library.py


示例7: drawY

def drawY(length):
    """
    Draw English character 'Y'
    :pre: (relative) pos (X,Y), heading (east), up
    :post: (relative) pos (X+length,Y), heading (east), up
    :return: None
    """
    turtle.up()
    turtle.left(90)
    turtle.forward(length)
    turtle.right(90)
    turtle.down()
    turtle.right(45)
    turtle.forward(math.sqrt((2 * math.pow((length / 2), 2))))
    # moving at 45 degree angle for length sqrt(((math.pow((length/2)+(math.pow((length/2)),2)))
    # calculated using pythagorean theorem.
    turtle.right(45)
    turtle.forward(length / 2)
    turtle.right(180)
    turtle.forward(length / 2)
    turtle.right(45)
    turtle.forward(math.sqrt((2 * math.pow((length / 2), 2))))
    turtle.right(45)
    turtle.up()
    turtle.right(90)
    turtle.forward(length)
    turtle.left(90)
    turtle.up()
开发者ID:deepaksharma36,项目名称:Python-Assignements,代码行数:28,代码来源:typography.py


示例8: 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


示例9: newSnow

def newSnow(size,n):
	x=size/2
	y=.4
	if n<=0 or size<10:
		return
	else:
		for i in range(2):
			if n%2==0:
				turtle.color("#0099CC")
			elif n%3==0:
				turtle.color("#B2DFEE")
			else:
				turtle.color("#00B2EE")
			turtle.forward(y*size/2)
			turtle.left(60)
			newSnow(x,n-1)
			turtle.right(120)
			newSnow(x,n-1)
			turtle.left(60)
			x/=2
			y+=.2
		if n%2==0:
				turtle.color("#0099CC")
		elif n%3==0:
			turtle.color("#B2DFEE")
		else:
			turtle.color("#00B2EE")
		turtle.forward(.4*size/2)
		turtle.up()
		turtle.back(1.4*size/2)
		turtle.down()
	return
开发者ID:wish343,项目名称:Python,代码行数:32,代码来源:SnowFlake.py


示例10: bezier

def bezier(smooth, x1, y1, x2, y2, x3, y3, *others):

	if len(others) % 2 != 0:
		print("Missing point data.")
		return
	if smooth < 1:
		print("Invalid smooth value")
		return
	wasDown = turtle.isdown()
	points = list(others)
	xval = [x1, x2, x3] + points[0:len(points):2]
	yval = [y1, y2, y3] + points[1:len(points):2]
	t, n, factn, step = 0, len(xval) - 1, factoral(len(xval) - 1), 1.0/smooth
	turtle.up()
	turtle.goto(x1, y1)
	if wasDown:
		turtle.down()
	while(t <= 1):
		x, y = 0, 0
		for i in range(0, n+1):
			b = factn / ((factoral(i)) * (factoral(n - i))) #binomial coefficient
			k = ((1 - t) ** (n - i)) * (t ** i) 			#powers
			x += b * k * xval[i] 							#parametric application
			y += b * k * yval[i] 							#to x and y
		turtle.goto(x, y)
		t += step
开发者ID:rayman456,项目名称:Python,代码行数:26,代码来源:GraphicsFunctions.py


示例11: drawBorder

def drawBorder():
    """Draw a circle for the outline of the thingy. that is a circle of radius 100"""
    turtle.right( 90 )
    turtle.down()
    turtle.circle( 100 )
    turtle.up()
    turtle.left( 90 )
开发者ID:dxa4481,项目名称:RITprojects,代码行数:7,代码来源:homeworkone.py


示例12: questionMark

def questionMark(scale = 1):
    """ Draw a question mark. 
 
    """ 
    turtle.up()
    turtle.forward( 10 * scale )
    turtle.down()
    turtle.left( 90 )
    turtle.forward( 2 * scale )
    turtle.up()
    turtle.forward( 3 * scale )
    turtle.down()
    turtle.forward( 5 * scale)
    turtle.right( 90 )
    turtle.forward( 10 * scale)
    turtle.left( 90 )
    turtle.forward( 10 * scale )
    turtle.left( 90 )
    turtle.forward( 20 * scale )
    turtle.left( 90 )
    turtle.forward( 5 * scale )
    turtle.up()
    turtle.forward( 15 * scale )
    turtle.left( 90 )
    turtle.forward ( 30 * scale )
开发者ID:chemdog,项目名称:IntroCS,代码行数:25,代码来源:letter_library.py


示例13: sun

def sun(argv):
	lsys_filename3 = argv[3]
	lsys3 = ls.createLsystemFromFile( lsys_filename3 )
	print lsys3
	num_iter3 = int( 3 )
	dist = 5
	angle3 = float( 120 )
	
	s3 = ls.buildString( lsys3, num_iter3 )
	
	#draw lsystem3
	'''this is my third lsystem
		with filename mysystem3.txt
		with 3 iterations and
		with angle = 45 dist = 10'''
	turtle.up()
	turtle.goto(0,0)
	turtle.goto(300, 200)
	turtle.down()
	turtle.setheading(0)
	turtle.left(90)
	turtle.pencolor('Red')
	it.drawString( s3, dist, angle3 )
	

	# wait and update
	turtle.update()
开发者ID:akaralekas,项目名称:cs151-colby,代码行数:27,代码来源:scene.py


示例14: tree2

def tree2(argv, x, y):
	lsys_filename2 = argv[2]
	lsys2 = ls.createLsystemFromFile( lsys_filename2 )
	print lsys2
	num_iter2 = int( 3 )
	dist = float( 5 )
	angle2 = float( 30 )
	
	s2 = ls.buildString( lsys2, num_iter2 )
	
	#draw lsystem2
	'''this is my second lsystem
		with filename mysystem2.txt
		with 5 iterations and
		with angle = 120 dist = 10'''
	turtle.up()
	turtle.goto(0,0)
	turtle.goto(x,y)
	turtle.down()
	turtle.setheading(0)
	turtle.left(90)
	turtle.pencolor('White')
	it.drawString( s2, dist, angle2 )
	
	# wait and update
	turtle.update()
开发者ID:akaralekas,项目名称:cs151-colby,代码行数:26,代码来源:scene.py


示例15: hexagone

def hexagone(c, longueur,m, col1, col2, col3,deform):
    """
    Draws a hexagon with or without deformation
    """
    lo = longueur
    x,y,z = c #Hexagon centre
    pa1,pa2,pa3 = (x+lo,y,z), (x+(lo/2),y-m,z), (x-(lo/2),y-m,z)#First losange coordinates (lower right)
    pb1,pb2,pb3 = (x+lo,y,z), (x+(lo/2),y+m,z), (x-(lo/2),y+m,z)#Losange 2 (upper right)
    pc1,pc2,pc3 = (x-(lo/2),y+m,z), (x-lo,y,z), (x-(lo/2),y-m,z)#Losange 3 (left)
    pts = [pa1,pa2,pa3,c,pb1,pb2,pb3,c,pc1,pc2,pc3,c]
    d = []
    for point in pts:
        xd,yd,zd = deform(point)
        d.extend((xd,yd))
    up()
    setpos(d[6],d[7])#Turtle resets to c
    down()
    col = [col1,col2,col3]
    i = 0
    for e in col:
        color(e)
        begin_fill()
        goto(d[i],d[i+1])
        goto(d[i+2],d[i+3])
        goto(d[i+4],d[i+5])
        goto(d[i+6],d[i+7])
        end_fill()
        i += 8
开发者ID:JeremyBlumenthal,项目名称:School_projects,代码行数:28,代码来源:vasarely.py


示例16: tSquare

def tSquare(size, level):
    """ The T-Square fractal.
    http://en.wikipedia.org/wiki/T-Square_%28fractal%29
    """

    if level < 1:
        drawSquare(size, True)
    else:
        drawSquare(size, True)
        bk(size / 4.0)
        left(90)
        fd(size / 4.0)
        right(90)
        tSquare(size / 2.0, level - 1)
        up()
        fd(size)
        down()
        tSquare(size / 2.0, level - 1)
        right(90)
        fd(size)
        left(90)
        tSquare(size / 2.0, level - 1)
        bk(size)
        tSquare(size / 2.0, level - 1)
        left(90)
        up()
        fd(size * 3 / 4.0)
        down()
        right(90)
        fd(size / 4.0)
开发者ID:peterasujan,项目名称:fractals,代码行数:30,代码来源:fractals.py


示例17: roach

def roach(turt):
    #make moves a global variable
    global moves
    turt.pencolor(randrange(255),randrange(255),randrange(255))
    turtle.up()
    turtle.goto(0,0)
    turtle.down()
    #write the code for roach to go & turn
    while True:
        moves += 1
        turt_heading = randrange(0,361)
        turt.left(turt_heading)
        turt_length = randrange(0,31)
        turt.forward(turt_length)
        distance = dist(turt)
        #if statement to determine if the roach is outside the circle or inside
        #if inside, keep moving
        #if outside, stop moving
        #return coordinate
        if distance >= 200:
            break
    turt.up()
    moves += moves                      #accummulate total moves
    print(moves)
    return moves
开发者ID:khoanguyen0791,项目名称:cs170,代码行数:25,代码来源:Roach+Race+2.py


示例18: drawK

def drawK():
    """
    Draw the alphabet K
    :pre: (relative) pos (0,0), heading (east), up
    :post: (relative) pos(CHAR_WIDTH + CHAR_GAP,0), heading (east), up
    :return: None
    """
    turtle.down()
    turtle.left(90)
    turtle.forward(CHAR_HEIGHT)
    turtle.backward(CHAR_HEIGHT/2)
    angleK = math.degrees(math.atan(2 * CHAR_WIDTH/CHAR_HEIGHT))
    turtle.right(angleK)
    #turtle.forward(math.sqrt(CHAR_HEIGHT^2 + CHAR_WIDTH^2)/2)

    turtle.forward(CHAR_HYPOT)
    turtle.backward(CHAR_HYPOT)
    turtle.right(180 - 2 * angleK)
    turtle.forward(CHAR_HYPOT)
    turtle.backward(CHAR_HYPOT)
    turtle.right(angleK)
    turtle.forward(CHAR_HEIGHT/2)
    turtle.left(90)
    turtle.up()
    turtle.forward(CHAR_WIDTH + CHAR_GAP)
开发者ID:AnushaBalusu,项目名称:PythonCodes,代码行数:25,代码来源:typography.py


示例19: draw_triangle

def draw_triangle(point1, point2, point3):
    turtle.up()
    turtle.goto(point1)
    turtle.down()
    turtle.goto(point2)
    turtle.goto(point3)
    turtle.goto(point1)
开发者ID:xzy3,项目名称:jormungard,代码行数:7,代码来源:Sierpinski.py


示例20: drawNose

def drawNose():
    """
    Draw the nostrils.
    :pre: (relative) pos (0,0), heading (east), up
    :post: (relative) pos (0,0), heading (east), up
    :return: None
    """
    turtle.forward(25)
    turtle.left(90)
    turtle.forward(30)
    turtle.left(45)
    turtle.forward(5)
    turtle.down()
    turtle.forward(1)
    turtle.back(1)
    turtle.up()
    turtle.back(5)
    turtle.right(90)
    turtle.forward(5)
    turtle.down()
    turtle.forward(1)
    turtle.back(1)
    turtle.up()
    turtle.back(5)
    turtle.left(45)
    turtle.up()
    turtle.back(30)
    turtle.right(90)
    turtle.back(25)
开发者ID:RIT-2015,项目名称:CPS,代码行数:29,代码来源:snack.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python turtle.end_fill函数代码示例发布时间:2022-05-27
下一篇:
Python turtle.dot函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap