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

Python turtle.begin_fill函数代码示例

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

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



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

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


示例2: draw_star

def draw_star(size, color):

    turtle.pendown()
    turtle.begin_fill()
    turtle.color(1,1,1)
    turtle.forward(2.5) 
    turtle.left(size)
    turtle.forward(2.5)
    turtle.right(144)
    turtle.forward(2.5)
    turtle.left(size)
    turtle.forward(2.5)
    turtle.right(144)
    turtle.forward(2.5)
    turtle.left(size)
    turtle.forward(2.5)
    turtle.right(144)
    turtle.forward(2.5)
    turtle.left(size)
    turtle.forward(2.5)
    turtle.right(144)
    turtle.forward(2.5)
    turtle.left(size)
    turtle.forward(2.5)
    turtle.right(144)
    turtle.end_fill()
    turtle.penup()
开发者ID:mukasama,项目名称:portfolio,代码行数:27,代码来源:Project++04.py


示例3: draw_circle

def draw_circle(x,y):
	turtle.penup()
	turtle.goto(x,y)
	turtle.pendown()
	turtle.begin_fill()
	turtle.circle(10)
	turtle.end_fill()
开发者ID:roni16-meet,项目名称:MEET-YL1,代码行数:7,代码来源:paint.py


示例4: block

def block( x, y, width, height, fill, color ):
	goto( x, y )
	
	print 'block(): drawing block of size', width, height
	# tell the turtle to go foward by width
	# tell the turtle to turn left by 90 degrees
	# tell the turtle to go forward by height
	# tell the turtle to turn left by 90 degrees
	# repeat the above 4 commands
	
	# if the parameter fill is true then do this
	if fill == "True":
		''' draw a block at position (x,y) with the
			given width and height, and fill with 
			the color '''
		t.begin_fill()
		t.color(color)
		for i in range(2):
			t.forward(width)
			t.left(90)
			t.forward(height)
			t.left(90)	
		t.end_fill()
	# if the parameter fill is false then do this
	else:
		''' draw a block at position (x,y) with the
			given width and height, and fill with 
			the color '''
		for i in range(2):
			t.forward(width)
			t.left(90)
			t.forward(height)
			t.left(90)	
开发者ID:akaralekas,项目名称:cs151-colby,代码行数:33,代码来源:better_shapelib.py


示例5: grass

def grass( x, y, scale ):
	'''draws a huge blue square given location and scale'''
	t.tracer(False)
	t.begin_fill()
	t.color('green')
	buildingblock(x-1000*scale, y-1000*scale, 2000*scale, 1075*scale)
	t.end_fill()
开发者ID:akaralekas,项目名称:cs151-colby,代码行数:7,代码来源:better_shapelib.py


示例6: circunferencia

def circunferencia(simbolos,identificador,linea):
  p1= obtener_punto(2,identificador,simbolos)
  radio = obtener_radio(identificador,simbolos)
  x1 = obtener_x(p1,simbolos)
  y1 = obtener_y(p1,simbolos)
 
  escalar = obtener_escalar(identificador, simbolos,linea)
  relleno = obtener_color(obtener_relleno(identificador,simbolos,linea))
  borde = obtener_color(obtener_borde(identificador,simbolos,linea))  
  turtle.color(borde)
  if escalar == 0:
    escalar=1
  tx = obtener_tx(identificador, simbolos,linea)
  ty = obtener_ty(identificador, simbolos,linea)
  turtle.pensize(8)
  turtle.penup()

  
  #Trasladar circunferencia
  x1 = x1 + tx
  y1 = y1 + ty

  #turtle.setposition(x1, y1-(radio*44))
  #turtle.pendown()
  #turtle.circle(radio*44)

  #Escalar circunferencia
  turtle.penup()
  #turtle.setposition(x1, y1-(radio*44*escalar))
  turtle.setposition(x1*44, (y1*44)-(radio*44*escalar))
  turtle.pendown()
  turtle.fillcolor(relleno)
  turtle.begin_fill()
  turtle.circle(radio*44*escalar)
  turtle.end_fill()
开发者ID:joenco,项目名称:compiladorg,代码行数:35,代码来源:figuras.py


示例7: star

def star( x, y, scale, fill, color ):
	'''draws a star given location, scale, and color'''
	goto( x, y )
	
	if fill == "True":
		'''if the scale is 1, and fill == True
			then this function will draw a star 
			with its left point at (x,y) and
			will have star ray lengths of 50
			and filled with the color given'''
		t.begin_fill()
		t.color(color)
		for i in range(10):
			t.forward(50*scale)
			t.right(108)
			t.forward(50*scale)
			t.left(144)
		t.end_fill()
	else: 
		'''if the scale is 1, and fill == False
			then this function will draw a star 
			with its left point at (x,y) and
			will have star ray lengths of 50
			and with no color fill'''
		t.begin_fill()
		for i in range(10):
			t.forward(50*scale)
			t.right(108)
			t.forward(50*scale)
			t.left(144)
开发者ID:akaralekas,项目名称:cs151-colby,代码行数:30,代码来源:better_shapelib.py


示例8: drawCircleAt

def drawCircleAt(turtleX, turtleY, circleSize):
    turtle.penup()
    turtle.goto(turtleX,turtleY)
    turtle.pendown()
    turtle.begin_fill()
    turtle.circle(circleSize)
    turtle.end_fill()
开发者ID:cparker,项目名称:pythonclub,代码行数:7,代码来源:one.py


示例9: draw_rectangle

def draw_rectangle():
    Fline = line.split()
    if Fline[1] == 'not_int':
        print(Fline)
        print("I'm sorry, I cannot understand that integer")
        return
    if len(Fline) < 4:
        print(Fline)
        print("I'm sorry, I do not understand that value")
        return
    x = int(Fline[1])
    y = int(Fline[2])
    width = int(Fline[3])
    height = int(Fline[4])
    turtle.penup()
    turtle.setpos(x, y)
    turtle.setheading(0)
    turtle.pendown()
    turtle.begin_fill()
    turtle.forward(width)
    turtle.setheading(-90)
    turtle.forward(height)
    turtle.setheading(180)
    turtle.forward(width)
    turtle.setheading(90)
    turtle.forward(height)
    turtle.end_fill()
开发者ID:thatsmysky,项目名称:Python-Program-Four,代码行数:27,代码来源:PROGRAM+4+CODE.py


示例10: drawHead

def drawHead(circum, colour="yellow"):

    #turtle.pencolor("yellow")
    turtle.color("black", colour)
    turtle.begin_fill()
    drawCircle(circum)
    turtle.end_fill()
开发者ID:rckc,项目名称:CoderDojoUWA2016,代码行数:7,代码来源:ManyFaces.py


示例11: draw_vertrect

def draw_vertrect(length,width,color):
    turtle.pendown()
    turtle.color(color)
    turtle.begin_fill()
    #uses color to determine length of cross
    if(color=="blue" or color == "red" or color == "light coral" or color=="yellow"):
        length*=.4375
    elif(color == "snow"or color=="navy" ):
        length*=.42857
    else:
        length*=.375
    print("the length of the first " , length, " and the width is ", width)
    #loops to draw vertical rectangle
    for x in range(5):
        if(x%5==0):
            #draws first half of left vertical line
            turtle.forward((length))
            print("drawing length")
        #draws from top of vertical to bottom of flag
        elif(x%2==0):
            turtle.forward(length*2+width)
            print("drawing long side")
        #draws small side of vertical rectangle
        elif(x!=5):
            turtle.forward(width)
        turtle.right(90)
    turtle.end_fill()
开发者ID:joshbenner851,项目名称:CSE231,代码行数:27,代码来源:proj06.py


示例12: draw_rectangle

def draw_rectangle(x,y,width,height):
    """
    Draws a rectangle with the upper left hand corner starting at point (x,y).
    The said rectangle has the dimensions width x height.
    :param x:
    :param y:
    :param width:
    :param height:
    :return: None
    """
    turtle.penup()
    turtle.setx(x)
    turtle.sety(y)
    turtle.pendown()
    turtle.setheading(0)  # Set heading in x+ direction
    turtle.begin_fill()
    turtle.begin_poly()
    turtle.fd(width)
    turtle.right(90)
    turtle.fd(height)
    turtle.right(90)
    turtle.fd(width)
    turtle.right(90)
    turtle.fd(height)
    turtle.end_poly()
    turtle.end_fill()
    return None
开发者ID:brendanoconnor913,项目名称:pythonwork,代码行数:27,代码来源:Assignment4-turtlegraphics.py


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


示例14: draw_tree

def draw_tree(x,y):
    startPosX = x
    startPosY = y
    turtle.setpos(x,y)
    turtle.fillcolor("green")
    turtle.begin_fill()
    for i in range(0,4):
        x -=40
        y -=80
        turtle.goto(x,y)
        coords.append(turtle.pos())
        x += 20
        turtle.goto(x,y)
    bottomCorner = turtle.pos()
    x = startPosX
    y = startPosY
    turtle.setpos(x,y)
    for i in range(0,4):
        x +=40
        y -=80
        turtle.goto(x,y)
        coords.append(turtle.pos())
        x -= 20
        turtle.goto(x,y)
    turtle.goto(bottomCorner)
    turtle.end_fill()
开发者ID:nyep,项目名称:learning-prog,代码行数:26,代码来源:turtleTree+[WIP].py


示例15: dope_flowers

def dope_flowers(x, y):
    turtle.pendown()
    turtle.begin_fill()
    move(turtle, 100)
    flower(turtle, 10, 20.0, 60.0)
    turtle.end_fill()
    turtle.penup()
开发者ID:TeenFAQ,项目名称:omgglaura.github.io,代码行数:7,代码来源:flowers.py


示例16: drawPoint

def drawPoint(x, y): 
    turtle.penup() # Pull the pen up
    turtle.goto(x, y)
    turtle.pendown() # Pull the pen down
    turtle.begin_fill() # Begin to fill color in a shape
    turtle.circle(3) 
    turtle.end_fill() # Fill the shape
开发者ID:EthanSeaver,项目名称:Python-Projects,代码行数:7,代码来源:UsefulTurtleFunctions.py


示例17: pythagoras_tree

def pythagoras_tree(size, n):
    turtle.begin_fill()
    for _ in range(4):
        turtle.forward(size)
        turtle.left(90)

    turtle.end_fill()
    if n > 0:
        roof = .5 * math.sqrt(2) * size

        turtle.left(90)
        turtle.forward(size)
        turtle.right(45)

        pythagoras_tree(roof, n - 1)

        turtle.forward(roof)
        turtle.right(90)

        pythagoras_tree(roof, n - 1)

        turtle.left(90)
        turtle.backward(roof)
        turtle.left(45)
        turtle.backward(size)
        turtle.right(90)
开发者ID:greut,项目名称:turtle-and-l-system,代码行数:26,代码来源:10_01_pythagoras_tree.py


示例18: rand_circle

def rand_circle():
    color = choice(colors)
    turtle.color(color, color)
    radius = randint(10, 100)
    turtle.begin_fill()
    turtle.circle(radius)
    turtle.end_fill()
开发者ID:lvidarte,项目名称:python-raspberry,代码行数:7,代码来源:turtle-4.py


示例19: drawmountain

def drawmountain(x,y,color):
	t.up
	t.goto(x,y)
	t.down
	t.color(color)
	t.begin_fill()
	t.backward(200)
	t.right(120)
	t.backward(200)
	t.right(120)
	t.backward(200)
	t.right(120)
	t.end_fill()
	t.up

	t.goto(x-75,y+125)
	t.down
	t.color("White")
	t.begin_fill()
	t.backward(50)
	t.right(120)
	t.backward(50)
	t.right(120)
	t.backward(50)
	t.right(120)
	t.end_fill()
	t.up
开发者ID:ccasey645,项目名称:OldMachine,代码行数:27,代码来源:drawchristmas.py


示例20: cross

def cross( x, y, scale, color ):
	'''draws a cross given location, scale, and color'''
	goto( x, y )
	turtle.begin_fill()
	turtle.color(color)
	turtle.forward(50*scale)
	turtle.right(90)
	turtle.forward(50*scale)
	turtle.left(90)
	turtle.forward(15*scale)
	turtle.left(90)
	turtle.forward(50*scale)
	turtle.right(90)
	turtle.forward(50*scale)
	turtle.left(90)
	turtle.forward(15*scale)
	turtle.left(90)
	turtle.forward(50*scale)
	turtle.right(90)
	turtle.forward(50*scale)
	turtle.left(90)
	turtle.forward(15*scale)
	turtle.left(90)
	turtle.forward(50*scale)
	turtle.right(90)
	turtle.forward(50*scale)
	turtle.left(90)
	turtle.forward(15*scale)
	turtle.end_fill()
开发者ID:akaralekas,项目名称:cs151-colby,代码行数:29,代码来源:shapelib.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python turtle.bgcolor函数代码示例发布时间:2022-05-27
下一篇:
Python turtle.backward函数代码示例发布时间: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