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


Python turtle.pensize函数代码示例

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


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

示例1: main

def main():
    turtle.setup(1300, 800, 0, 0)   # 启动图形窗口
    pythonsize = 10
    turtle.pensize(pythonsize)
    turtle.pencolor("blue")
    turtle.seth(-40)        # 启动时运动的方向(角度)
    drawSnake(40, 80, 5, pythonsize/2)
开发者ID:xzlxiao,项目名称:Test,代码行数:7,代码来源:蟒蛇绘制.py

示例2: tree1

def tree1(iters, xpos, ypos):
	'''Creates lsystem from filename and then creates an arrangement'''
	# creates object from lsystem
	l1 = ls.Lsystem('lsystemextension1.txt')
	
	#number of iterations
	# for growth effect in task 3, made iters a parameter
	num_iter1 = iters
	
	#creates buildstring function
	s1 = l1.buildString(num_iter1)
	
	#specific angle
	angle = 15
	
	#creates an object from TI class
	ti = it.TurtleInterpreter()
	
	# sets the colors of the tracer and calls the drawstring function
	# orients the trees with parameters xpos and ypos
	# My Tree 1 (mylsystem1.txt)
	turtle.pencolor('DarkOliveGreen')
	turtle.pensize(2)
	'''tree with stem color of olivedrab'''
	turtle.up()
	turtle.setposition(xpos,ypos)
	turtle.setheading(90)
	turtle.down()
	ti.drawString(s1,7,angle)
开发者ID:akaralekas,项目名称:cs151-colby,代码行数:29,代码来源:project8extension3.py

示例3: initBannerCanvas

def initBannerCanvas( numChars, numLines ):
    """
    Set up the drawing canvas to draw a banner numChars wide and numLines high.
    The coordinate system used assumes all characters are 20x20 and there
    are 10-point spaces between them.
    Postcondition: The turtle's starting position is at the bottom left
    corner of where the first character should be displayed.
    """
    # This setup function uses pixels for dimensions.
    # It creates the visible size of the canvas.
    canvas_height = 80 * numLines 
    canvas_width = 80 * numChars 
    turtle.setup( canvas_width, canvas_height )

    # This setup function establishes the coordinate system the
    # program perceives. It is set to match the planned number
    # of characters.
    height = 30 
    width = 30  * numChars
    margin = 5 # Add a bit to remove the problem with window decorations.
    turtle.setworldcoordinates(
        -margin+1, -margin+1, width + margin, numLines*height + margin )

    turtle.reset()
    turtle.up()
    turtle.setheading( 90 )
    turtle.forward( ( numLines - 1 ) * 30 )
    turtle.right( 90 )
    turtle.pensize( 2 * scale)
开发者ID:jonobrien,项目名称:School_Backups,代码行数:29,代码来源:spell_out.py

示例4: main

def main():
    turtle.setup(1300, 800, 0, 0)
    pythonsize = 30
    turtle.pensize(pythonsize)
    turtle.pencolor("blue")
    turtle.seth(-40)
    drawSnake(40, 80, 5, pythonsize / 2)
开发者ID:16348104,项目名称:Python,代码行数:7,代码来源:python.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():  
    turtle.setup(1300,800,0,0)  
    pythonsize=1  
    turtle.pensize(pythonsize)  
    turtle.pencolor("black")  
    turtle.seth(-40)  
    drawSnack(40,80,5,pythonsize/2)  
开发者ID:lovexleif,项目名称:python,代码行数:7,代码来源:snake.py

示例7: plano2d

def plano2d():
  turtle.penup()

  for i in range(13):
    y = 264 - (44 *i)
    turtle.penup()
    turtle.setposition(-264,y)
    turtle.pendown()
    turtle.forward(528)
  
  turtle.right(90)

  for i in range(13):
    x = -264 + (44*i)
    turtle.penup()
    turtle.setposition(x,264)
    turtle.pendown()
    turtle.forward(528)
  
  turtle.penup()
  turtle.home()
  turtle.pendown()
  turtle.color("blue")         
  turtle.pensize(3)

  for i in range(4):
    grados = 90 * (i+1)
    turtle.home()
    turtle.left(grados)
    turtle.forward(264) 
开发者ID:joenco,项目名称:compiladorg,代码行数:30,代码来源:figuras.py

示例8: meet

def meet(x,y):
    turtle.pensize(15)
    m(x,y)
    e1(x,y)
    e2(x,y)
    f(x,y)
    TM(x,y)   
开发者ID:jana16-meet,项目名称:MEET-YL1,代码行数:7,代码来源:PanitJana.py

示例9: drawFlower

def drawFlower(xCenter = 0, yCenter = 0, xRightUp = 0, yRightUp = 0,
    xRightDown = 0, yRightDown = 0, xLeftUp = 0, yLeftUp = 0,
    xLeftDown = 0, yLeftDown = 0, radius = 10):
    turtle.pensize(3)
    turtle.color(1.0, 0.41, 0.70) # Hot Pink
    turtle.penup()
    turtle.goto(xCenter, yCenter - radius)
    turtle.pendown()
    turtle.circle(radius)
    turtle.penup()
    turtle.goto(xRightUp, yRightUp - radius)
    turtle.pendown()
    turtle.circle(radius)
    turtle.penup()
    turtle.goto(xRightDown, yRightDown - radius)
    turtle.pendown()
    turtle.circle(radius)
    turtle.penup()
    turtle.goto(xLeftUp, yLeftUp - radius)
    turtle.pendown()
    turtle.circle(radius)
    turtle.penup()
    turtle.goto(xLeftDown, yLeftDown - radius)
    turtle.pendown()
    turtle.circle(radius)
开发者ID:mbernadette,项目名称:Designs,代码行数:25,代码来源:LoveKnots.Maria.Johnson.py

示例10: drawCircle

def drawCircle(x = 0, y = 0, radius = 10, mycolor = (0.49, 0.99, 0.00)): # Lawn Green
    turtle.pencolor(mycolor[0], mycolor[1], mycolor[2])
    turtle.pensize(4)
    turtle.penup()
    turtle.goto(x, y - radius)
    turtle.pendown()
    turtle.circle(radius)
开发者ID:mbernadette,项目名称:Designs,代码行数:7,代码来源:LoveKnots.Maria.Johnson.py

示例11: drawLine

def drawLine(x1, y1, x2, y2):
    turtle.pensize(5)
    turtle.color(0.27, 0.51, 0.71) # Steel Blue
    turtle.penup()
    turtle.goto(x1, y1)
    turtle.pendown()
    turtle.goto(x2, y2)
开发者ID:mbernadette,项目名称:Designs,代码行数:7,代码来源:LoveKnots.Maria.Johnson.py

示例12: writeText

def writeText(s, x, y):
    turtle.pensize(1)
    turtle.color(0.28, 0.24, 0.55) # Dark Slate Blue
    turtle.penup()
    turtle.goto(x, y)
    turtle.pendown()
    turtle.write(s, align="center", font=("Times", 15, "italic"))
开发者ID:mbernadette,项目名称:Designs,代码行数:7,代码来源:LoveKnots.Maria.Johnson.py

示例13: main

def main():
	turtle.setup(1300, 800, 0, 0)
	pythonsize = 30
	turtle.pensize(pythonsize)
	turtle.pencolor('blue')
	turtle.seth(-40)
	drawSnake(rad = 40, angle = 80, len = 5, neckrad = pythonsize/2 )
开发者ID:Andor-Z,项目名称:My-Learning-Note,代码行数:7,代码来源:week2.py

示例14: test_same_function_names_work

    def test_same_function_names_work(self):
        # draw some things using the english commands in tortuga
        tortuga.forward(50)
        tortuga.left(90)
        tortuga.forward(50)
        tortuga.right(45)
        tortuga.backward(50)
        tortuga.left(45)
        tortuga.pensize(5)
        for c in (english_colors):
            tortuga.color(c)
            tortuga.forward(10)

        # now draw the same things using turtle
        turtle.forward(50)
        turtle.left(90)
        turtle.forward(50)
        turtle.right(45)
        turtle.backward(50)
        turtle.left(45)
        turtle.pensize(5)
        for c in (english_colors):
            turtle.color(c)
            turtle.forward(10)

        # and make sure they both resulted in the same output
        self.assert_same()
开发者ID:asweigart,项目名称:tortuga,代码行数:27,代码来源:turtleTest.py

示例15: test_equivalent_spanish_names_work

    def test_equivalent_spanish_names_work(self):
        # draw some things using the english commands in tortuga
        tortuga.adelante(50)
        tortuga.izquierda(90)
        tortuga.adelante(50)
        tortuga.derecho(45)
        tortuga.atras(50)
        tortuga.izquierda(45)
        tortuga.tamano_lapiz(5)
        for c in (english_colors):
            tortuga.color(c)
            tortuga.adelante(10)
        for c in (spanish_colors):
            tortuga.color(c)
            tortuga.adelante(10)

        # now draw the same things using turtle
        turtle.forward(50)
        turtle.left(90)
        turtle.forward(50)
        turtle.right(45)
        turtle.backward(50)
        turtle.left(45)
        turtle.pensize(5)
        for c in (english_colors):
            turtle.color(c)
            turtle.forward(10)
        for c in (english_colors):
            turtle.color(c)
            turtle.forward(10)

        # and make sure they both resulted in the same output
        self.assert_same()
开发者ID:asweigart,项目名称:tortuga,代码行数:33,代码来源:turtleTest.py


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