本文整理汇总了Python中turtle.Turtle.shapesize方法的典型用法代码示例。如果您正苦于以下问题:Python Turtle.shapesize方法的具体用法?Python Turtle.shapesize怎么用?Python Turtle.shapesize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类turtle.Turtle
的用法示例。
在下文中一共展示了Turtle.shapesize方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Lampe
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import shapesize [as 别名]
class Lampe():
lyser = False
turtle = None
def lag_skilpadde(self):
""" Lager en egen skilpadde for denne lamen."""
self.turtle = Turtle()
self.turtle.penup()
self.turtle.hideturtle()
# Gult lys når vi lyser.
self.turtle.shape('circle')
self.turtle.color('yellow')
self.turtle.shapesize(5)
def slaa_paa(self):
self.lyser = True
self.turtle.showturtle()
def slaa_av(self):
self.lyser = False
self.turtle.hideturtle()
示例2: maketree
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import shapesize [as 别名]
def maketree(x):
p = Turtle(shape="triangle", visible=False)
p.setundobuffer(None)
p.fillcolor("green")
p.shapesize(0.4)
p.speed(0)
p.left(90)
p.penup()
p.goto(x, -110)
p.pendown()
return tree([p], 140, 65, 0.6375)
示例3: maketree
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import shapesize [as 别名]
def maketree():
p = Turtle(shape="triangle", visible=False)
p.setundobuffer(None)
p.fillcolor("green")
p.shapesize(0.4)
p.speed(0)
p.left(90)
p.penup()
p.backward(210)
p.pendown()
tree([p], 200, 65, 0.6375)
示例4: Screen
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import shapesize [as 别名]
#!/usr/bin/python
# coding: utf-8
from turtle import Screen
from turtle import Turtle
s = Screen()
s.bgcolor('black')
ikea_lys = Turtle()
bestemors_lys = Turtle()
ikea_lys.shape('circle')
ikea_lys.color('black')
ikea_lys.shapesize(3)
bestemors_lys.shape('circle')
bestemors_lys.color('black')
bestemors_lys.shapesize(3)
class Lampe():
lyser = False
turtle = None
def lag_skilpadde(self):
""" Lager en egen skilpadde for denne lamen."""
self.turtle = Turtle()
self.turtle.penup()
self.turtle.hideturtle()
# Gult lys når vi lyser.
示例5: Material
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import shapesize [as 别名]
class Material(object):
def __init__(self):
self.gods_hand = Turtle()
self.gods_hand.hideturtle()
self.gods_hand.speed(0)
def draw_line(self):
self.gods_hand.penup()
self.gods_hand.tracer(0, 0)
self.gods_hand.goto(100, 100)
self.gods_hand.pendown()
self.gods_hand.fill(True)
self.gods_hand.setheading(0)
self.gods_hand.forward(50)
self.gods_hand.setheading(90)
self.gods_hand.forward(50)
self.gods_hand.setheading(180)
self.gods_hand.forward(50)
self.gods_hand.setheading(270)
self.gods_hand.forward(50)
self.gods_hand.fill(False)
self.gods_hand.penup()
self.gods_hand.goto(120, 120)
self.gods_hand.pendown()
self.gods_hand.pencolor("Blue")
self.gods_hand.fillcolor("Blue")
self.gods_hand.fill(True)
self.gods_hand.setheading(0)
self.gods_hand.forward(10)
self.gods_hand.setheading(90)
self.gods_hand.forward(10)
self.gods_hand.setheading(180)
self.gods_hand.forward(10)
self.gods_hand.setheading(270)
self.gods_hand.forward(10)
self.gods_hand.fill(False)
self.gods_hand.penup()
self.gods_hand.tracer(1, 1)
def build_box(self, pos_x, pos_y, length_x, length_y, do_fill, color):
pos_x, pos_y = coordinate_converter((pos_x, pos_y))
self.gods_hand.tracer(0, 0)
self.gods_hand.penup()
self.gods_hand.goto(pos_x, pos_y)
self.gods_hand.pendown()
if do_fill:
self.gods_hand.fill(True)
self.gods_hand.color(color)
for x in range(4, 0, -1):
heading = x * 90
self.gods_hand.setheading(heading)
self.gods_hand.forward(length_x)
if do_fill:
self.gods_hand.fill(False)
self.gods_hand.tracer(1, 1)
def draw_human(self, pos_x, pos_y):
self.gods_hand.tracer(0, 0)
self.gods_hand.penup()
self.gods_hand.goto(pos_x, pos_y)
self.gods_hand.color("blue")
self.gods_hand.shape("circle")
self.gods_hand.shapesize(0, 0, 5)
stampid = self.gods_hand.stamp()
self.gods_hand.color("black")
self.gods_hand.tracer(1, 1)
return stampid
def erase_human(self, stampid):
self.gods_hand.clearstamp(stampid)
示例6: Screen
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import shapesize [as 别名]
games. Bear in mind that the simplicity of the turtle library hurts its performance
considerabily. Therefore is is seen as a stepping stone to other more powerful low-level
libraries such as openGl, Vulkan and DirectX12
-------------------------------------- Jonas -------------------- """
from turtle import Turtle, Screen
# --- Create objects---
screen = Screen()
tut1 = Turtle()
tut2 = Turtle()
# --- INIT turtles ---
tut1.speed(1)
tut1.penup()
tut1.shape("circle")
tut1.shapesize(5)
tut1.color("red")
tut2.speed(1)
tut2.penup()
tut2.shape("square")
tut2.shapesize(5)
tut2.color("blue")
# --- ACTION ---
tut1.forward(100)
tut2.backward(100)
screen.mainloop()
示例7: Turtle
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import shapesize [as 别名]
s.setup(560,560)
s.title("A drunken turtle collecting ...")
s.tracer(False)
writer = Turtle(visible=False)
writer.penup()
writer.goto(0, -275)
coins = []
for i in range(-4,5):
for j in range(-4, 5):
if i == j == 0:
continue
c = Turtle(shape="circle")
c.color("", "orange")
c.shapesize(0.5)
c.goto(40*i, 40*j)
coins.append(c)
s.tracer(True)
DRUNKENNESS = 45
t = Turtle(shape="turtle")
t.color("black","")
points = 0
while abs(t.xcor()) < 200 and abs(t.ycor()) < 200:
t.forward(5)
t.right(randint(-DRUNKENNESS, DRUNKENNESS))
found = None
for c in coins:
if t.distance(c) < 10:
found = c