本文整理汇总了Python中turtle.color函数的典型用法代码示例。如果您正苦于以下问题:Python color函数的具体用法?Python color怎么用?Python color使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了color函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: tscm_color
def tscm_color(c):
"""Set the color to C, a symbol such as red or '#ffc0c0' (representing
hexadecimal red, green, and blue values."""
_tscm_prep()
check_type(c, scm_symbolp, 0, "color")
turtle.color(str(c))
return UNSPEC
开发者ID:UCBpetersoncheng,项目名称:sample,代码行数:7,代码来源:scheme_primitives.py
示例2: show_sharks
def show_sharks(self, sharks):
self.update_cnt += 1
if UPDATE_EVERY > 0 and self.update_cnt % UPDATE_EVERY != 1:
return
turtle.clearstamps()
draw_cnt = 0
px = {}
for shark in sharks:
draw_cnt += 1
shark_shape = 'classic' if shark.tracked else 'classic'
if DRAW_EVERY == 0 or draw_cnt % DRAW_EVERY == 0:
# Keep track of which positions already have something
# drawn to speed up display rendering
scaled_x = int(shark.x * self.one_px)
scaled_y = int(shark.y * self.one_px)
scaled_xy = scaled_x * 10000 + scaled_y
turtle.color(shark.color)
turtle.shape(shark_shape)
turtle.resizemode("user")
turtle.shapesize(1.5,1.5,1)
if not scaled_xy in px:
px[scaled_xy] = 1
turtle.setposition(*shark.xy)
turtle.setheading(math.degrees(shark.h))
turtle.stamp()
开发者ID:hmc-lair,项目名称:multitarget_state_estimator,代码行数:26,代码来源:draw.py
示例3: show_robot
def show_robot(self, robot):
turtle.color("blue")
turtle.shape('square')
turtle.setposition(*robot.xy)
turtle.setheading(math.degrees(robot.h))
turtle.stamp()
turtle.update()
开发者ID:hmc-lair,项目名称:multitarget_state_estimator,代码行数:7,代码来源:draw.py
示例4: polygon
def polygon(side = 50, angle = None, xstart = None, ystart = None, numberSides = 3, color = 'black', fill = False):
turtle.pensize(3)
turtle.speed('fastest')
turtle.hideturtle()
if angle != None:
turtle.left(angle)
turtle.penup()
if fill == True:
if xstart != None or ystart != None:
turtle.goto(xstart, ystart)
else:
turtle.goto(0, 0)
turtle.color(color)
turtle.pendown()
turtle.begin_fill()
turtle.circle(side, 360, numberSides)
turtle.end_fill()
turtle.penup()
else:
turtle.goto(xstart, ystart)
turtle.color(color)
turtle.pendown()
turtle.circle(side, 360, numberSides)
turtle.penup()
return
开发者ID:JakenHerman,项目名称:python-homework,代码行数:28,代码来源:GraphicsAndPatternLibrary.py
示例5: draw
def draw(cmds, size=2): #output tree
stack = []
for cmd in cmds:
if cmd=='F':
turtle.forward(size)
elif cmd=='-':
t = random.randrange(0,7,1)
p = ["Red","Green","Blue","Grey","Yellow","Pink","Brown"]
turtle.color(p[t])
turtle.left(15) #slope left
elif cmd=='+':
turtle.right(15) #slope right
t = random.randrange(0,7,1) #рандомная пер. для цвета
p = ["Red","Green","Blue","Grey","Yellow","Pink","Brown"] #ряд цветов
turtle.color(p[t]) #выбор цвета из ряда
elif cmd=='X':
pass
elif cmd=='[':
stack.append((turtle.position(), turtle.heading()))
elif cmd==']':
position, heading = stack.pop()
turtle.penup()
turtle.setposition(position)
turtle.setheading(heading)
turtle.pendown()
turtle.update()
开发者ID:Papapashu,项目名称:main,代码行数:26,代码来源:python_three.py
示例6: theStem
def theStem(stemLength=100):
turtle.home()
turtle.forward(25)
turtle.left(90)
turtle.pensize(4)
turtle.color("green")
turtle.forward(stemLength)
开发者ID:KrbAlmryde,项目名称:Homework,代码行数:7,代码来源:ISTA130_HW1b.py
示例7: drawLine
def drawLine(x1, y1, x2, y2, color = "black", size = 1):
turtle.color(color)
turtle.pensize(size)
turtle.penup()
turtle.goto(x1, y1)
turtle.pendown()
turtle.goto(x2, y2)
开发者ID:EthanSeaver,项目名称:Python-Projects,代码行数:7,代码来源:Exercise6_38.py
示例8: 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
示例9: 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
示例10: curva
def curva(simbolos,identificador,linea):
p1= obtener_punto(1,identificador,simbolos)
p2= obtener_punto(2,identificador,simbolos)
x1 = int (obtener_x(p1,simbolos))
y1 = int (obtener_y(p1,simbolos))
x2 = obtener_x(p2,simbolos)
y2 = obtener_y(p2,simbolos)
rotar = obtener_rotar(identificador, simbolos,linea)
escalar = obtener_escalar(identificador, simbolos,linea)
relleno = obtener_color(obtener_relleno(identificador,simbolos,linea))
turtle.color(relleno)
tx = obtener_tx(identificador, simbolos,linea)
ty = obtener_ty(identificador, simbolos,linea)
potencia = obtener_potencia(identificador,simbolos)
#Trasladar recta
x1 = int(x1*44 + tx*44)
x2 = int(x2*44 + tx*44)
y1 = y1*44 + ty*44
y2 = y2*44 + ty*44
turtle.penup()
for x in range(x1,x2):
turtle.goto(x+(44), (x+(44))**potencia)
turtle.pendown()
开发者ID:joenco,项目名称:compiladorg,代码行数:27,代码来源:figuras.py
示例11: 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
示例12: draw_coordinate_systen
def draw_coordinate_systen(screen_dimension,function, input_range):
"""
Draws Coordinate System on screen
@param screen_dimension
"""
turtle.penup()
turtle.goto(0,screen_dimension[1])
turtle.pendown()
turtle.goto(0,-screen_dimension[1])
turtle.penup()
turtle.goto(-screen_dimension[1],0)
turtle.pendown()
turtle.goto(screen_dimension[1],0)
turtle.penup()
turtle.goto(0,0)
#titles (equation, input_range)
turtle.color("red")
turtle.penup()
turtle.goto(-screen_dimension[0]+100,screen_dimension[1]-30)
turtle.pendown()
turtle.write("Wykres f(x)="+function)
turtle.penup()
turtle.goto(-screen_dimension[0]+100,screen_dimension[1]-40)
turtle.pendown()
turtle.write("input_range: "+str(input_range))
turtle.penup()
开发者ID:KrzyKuStudio,项目名称:EquationGrapher,代码行数:27,代码来源:EquationGrapher.py
示例13: draw_borders
def draw_borders(screen_dimension, left, right, down, up):
"""
Draws border titles
@param screen_dimension
@param left - left x
@param right - right x
@param up - up y
@param down - down y
"""
#boundary titles
turtle.color("black")
turtle.penup()
turtle.goto(-screen_dimension[0]+100,10)
turtle.pendown()
if(left<0):
turtle.write(str(left))
turtle.penup()
turtle.goto(screen_dimension[0]-150,10)
turtle.pendown()
turtle.write(str(right))
turtle.penup()
turtle.goto(5,screen_dimension[1]-20)
turtle.pendown()
turtle.write(str(up))
turtle.penup()
turtle.goto(5,-screen_dimension[1]+15)
turtle.pendown()
if(down<0):
turtle.write(str(down))
开发者ID:KrzyKuStudio,项目名称:EquationGrapher,代码行数:29,代码来源:EquationGrapher.py
示例14: draw_stars
def draw_stars():
for i in range(NSTARS):
x = random.randint(MINX, MAXX)
y = random.randint(GROUNDY, MAXY)
turtle.goto(x, y)
turtle.color('white')
turtle.dot(1)
开发者ID:sbihel,项目名称:retrogames,代码行数:7,代码来源:missile.py
示例15: 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
示例16: draw
def draw(self):
turtle.penup()
turtle.goto(self.point_st)
turtle.pendown()
turtle.color(self.border_c, self.fill_c)
self._draw()
开发者ID:mprihodko,项目名称:python,代码行数:7,代码来源:test3.py
示例17: forGlory
def forGlory(sideLength=50):
turtle.left(150)
turtle.penup()
turtle.setpos(-25,75)
turtle.color("blue")
turtle.pendown()
hexagon(sideLength)
开发者ID:KrbAlmryde,项目名称:Homework,代码行数:7,代码来源:ISTA130_HW1b.py
示例18: 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
示例19: tscheme_color
def tscheme_color(c):
"""Set the color to C, a string such as '"red"' or '"#ffc0c0"' (representing
hexadecimal red, green, and blue values."""
_tscheme_prep()
check_type(c, scheme_stringp, 0, "color")
turtle.color(eval(c))
return okay
开发者ID:61a-su15-website,项目名称:61a-su15-website.github.io,代码行数:7,代码来源:scheme_primitives.py
示例20: cloud
def cloud( x, y, scale, color):
'''draws a cloud given location and scale'''
goto( x, y )
t.begin_fill()
t.color(color)
t.circle(50*scale)
t.end_fill()
t.begin_fill()
t.color(color)
t.up()
t.forward(25*scale)
t.down()
t.circle(50*scale)
t.end_fill()
t.begin_fill()
t.color(color)
t.up()
t.forward(35*scale)
t.down()
t.circle(50*scale)
t.end_fill()
t.begin_fill()
t.color(color)
t.up()
t.forward(25*scale)
t.down()
t.circle(50*scale)
t.end_fill()
t.begin_fill()
t.color(color)
t.up()
t.forward(25*scale)
t.down()
t.end_fill()
开发者ID:akaralekas,项目名称:cs151-colby,代码行数:34,代码来源:better_shapelib.py
注:本文中的turtle.color函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论