本文整理汇总了Python中turtle.pensize函数的典型用法代码示例。如果您正苦于以下问题:Python pensize函数的具体用法?Python pensize怎么用?Python pensize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pensize函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: main
def main():
turtle.setup(800, 350, 200, 200)
turtle.penup()
turtle.fd(-300)
turtle.pensize(5)
drawDate(datetime.datetime.now().strftime('%Y%m%d'))
turtle.hideturtle()
开发者ID:BrandonSherlocking,项目名称:python_document,代码行数:7,代码来源:数码管.py
示例17: Eating
def Eating(cells):
for cell in cells:
for cell2 in cells:
if cell!=cell2:
min_d = cell.get_radius()+cell2.get_radius()
d = ((cell.xcor()-cell2.xcor())**2+(cell.ycor()-cell2.ycor())**2)**0.5
if d<min_d:
if cell.get_radius()>cell2.get_radius():
if cell2==user_cell:
turtle.pensize(50)
turtle.write("Game Over!")
meet.mainloop()
x=meet.get_random_x()
y=meet.get_random_y()
cell2.goto(x,y)
r = cell.get_radius() + 0.2 * cell2.get_radius()
cell.set_radius(r)
if cell2.get_radius()>cell.get_radius():
if cell==user_cell:
turtle.pensize(50)
turtle.write("Game Over!")
meet.mainloop()
x=meet.get_random_x()
y=meet.get_random_y()
cell.goto(x,y)
r = cell2.get_radius() + 0.2 * cell.get_radius()
cell2.set_radius(r)
开发者ID:bar17-meet,项目名称:MEET-YL1,代码行数:27,代码来源:MeetProject.py
示例18: skidMark
def skidMark(lineLength):
turtle.pensize(2)
turtle.pencolor(0, 0, 0)
for x in range(lineLength):
turtle.pencolor(x,x,x)
turtle.fd(x)
turtle.right(90)
开发者ID:KrbAlmryde,项目名称:Homework,代码行数:7,代码来源:Lab3.py
示例19: 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
示例20: SetupClock
def SetupClock(radius):
# 建立表的外框
turtle.reset()
turtle.pensize(7)
for i in range(60):
Skip(radius)
if i % 5 == 0:
turtle.forward(20)
Skip(-radius - 20)
Skip(radius + 20)
if i == 0:
turtle.write(int(12), align="center", font=("Courier", 14, "bold"))
elif i == 30:
Skip(25)
turtle.write(int(i/5), align="center", font=("Courier", 14, "bold"))
Skip(-25)
elif (i == 25 or i == 35):
Skip(20)
turtle.write(int(i/5), align="center", font=("Courier", 14, "bold"))
Skip(-20)
else:
turtle.write(int(i/5), align="center", font=("Courier", 14, "bold"))
Skip(-radius - 20)
else:
turtle.dot(5)
Skip(-radius)
turtle.right(6)
开发者ID:sfilata,项目名称:gitskills,代码行数:28,代码来源:clock.py
注:本文中的turtle.pensize函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论