本文整理汇总了Python中tealight.art.color函数的典型用法代码示例。如果您正苦于以下问题:Python color函数的具体用法?Python color怎么用?Python color使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了color函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: handle_mousemove
def handle_mousemove(x,y,button):
if button == "left":
color("cyan")
circle(x,y,10)
if button == "right":
color("random")
circle(x,y,5)
开发者ID:arty001,项目名称:tealight-files,代码行数:7,代码来源:input.py
示例2: draw
def draw(self, position = [30, 30], size = [200,200]):
#Convert rgba vector to string
def coltostr(col):
string_out = "rgba("
for i in range(0,3):
string_out = string_out + str(int(col[i])) + ","
string_out = string_out + str(col[3]) + ")"
return string_out
for i in range(0, self.i_size):
for j in range(0, self.j_size):
#Set rgba value based on max value
#Convert to color string "rgba(...)
#Positive values are red, negative are blue
#Values close to zero will be paler
if self.array[i][j] >= 0 :
alpha_value = 1.0 * self.array[i][j]/self.max()
rgba_string = coltostr([255, 0, 0, alpha_value])
else:
alpha_value = 1.0 * self.array[i][j]/self.min()
rgba_string = coltostr([0, 0, 255, alpha_value])
#Draw box
color(rgba_string)
box(position[0] + j * size[0]/self.j_size,
position[1] + i * size[1]/self.i_size,
size[0]/self.j_size - 1,
size[1]/self.i_size - 1)
开发者ID:pb471,项目名称:tealight-files,代码行数:31,代码来源:2DArray.py
示例3: handle_frame
def handle_frame():
global x,y,vx,vy,ax,ay
color("white")
spot(x,y,8)
vx = vx + ax
vy = vy + ay
#gravity
vy = vy + gravity
apply_gravity()
#friction
vx = apply_friction(vx)
vy = apply_friction(vy)
x = x + vx
y = y + vy
color("blue")
spot(x,y,8)
开发者ID:c-ryan747,项目名称:tealight-files,代码行数:29,代码来源:orbits.py
示例4: DrawPalette
def DrawPalette(x,y, colors, w, h):
for c in colors:
color(c)
box(x, y, w, h)
y = y + h
colors = ["black", "grey"]
开发者ID:bbenny0211,项目名称:tealight-files,代码行数:7,代码来源:alexinder.py
示例5: handle_frame
def handle_frame():
global x,y,vx,vy,ax,ay
if 1000 < y:
vy=-vy
elif y < 1:
vy=-vy
if 910 < x:
vx=-vx
elif x < 1:
vx=-vx
color("white")
spot(x,y,8)
vx = vx + ax
vy = vy + ay
x = x + vx
y = y + vy
color("blue")
spot(x,y,8)
开发者ID:LizzTebbutt,项目名称:tealight-files,代码行数:26,代码来源:orbits.py
示例6: handle_frame
def handle_frame():
global x,y,vx,vy,constant,n
n = n + 1
for i in range(0,len(x)):
color("white")
spot(x[i],y[i],2)
vx[i] = vx[i] + constant[i]
angle = math.atan2(-vy[i],vx[i]) + (math.pi / 2)
fx = 1 * math.cos(angle)
fy = -1 * math.sin(angle)
vxa = vx[i] + fx
vya = vy[i] + fy
factor = math.sqrt(vx[i]**2 + vy[i]**2) / math.sqrt(vxa**2 + vya**2)
vx[i] = vxa * factor
vy[i] = vya * factor
x[i] = x[i] + vx[i]
y[i] = y[i] + vy[i]
color("black")
spot(x[i],y[i],2)
开发者ID:c-ryan747,项目名称:tealight-files,代码行数:31,代码来源:physicsQuestion.py
示例7: DrawClear
def DrawClear(x,y):
color("white")
box(x*34+182,y*34+202,32,32)
color("Black")
if check(x,y) > 0:
text(x*34+192,y*34+207,check(x,y))
flags[x][y] = 3
开发者ID:jackm110,项目名称:tealight-files,代码行数:7,代码来源:Project.py
示例8: handle_frame
def handle_frame():
global x,y,vx,vy,ax,ay
color("white")
spot(x,y,8)
vx = vx + ax
vy = vy + ay
x2 = x + vx
y2 = y + vy
if x2 < 0:
x=-x2
vx=-vx
elif x2 > screen_width:
x=screen_width*2-x2
vx=-vx
else:
x=x2
if y2 < 0:
y=-y2
vy=-vy
elif y2 > screen_height:
y=screen_height*2-y2
vy=-vy
else:
y=y2
color("blue")
spot(x,y,8)
开发者ID:jonathan-dilorenzo,项目名称:tealight-files,代码行数:34,代码来源:orbits.py
示例9: flag
def flag(i,j):
color("red")
tx = startx + size/2 + i * size
ty = starty + size/2 + j * size
spot(tx, ty, size/3)
color("black")
text(tx - size/10, ty - size/10, "F")
开发者ID:AimeeH,项目名称:tealight-files,代码行数:7,代码来源:Minesweeper.py
示例10: handle_frame
def handle_frame():
global x,y,vx,vy,ax,ay
color("white")
spot(x,y,8)
vx = (vx*0.95) + ax
vy = (vy*0.95) + ay + 0.1
x = x + vx
y = y + vy
color("blue")
if x<=0 or x>=900:
vx = -vx
ax = (-0.8*ax)
elif y<=0 or y>=1000:
vy = -vy
ay = (-0.8*ay)
spot(x,y,8)
开发者ID:BasRegi,项目名称:tealight-files,代码行数:20,代码来源:orbits.py
示例11: handle_frame
def handle_frame():
global x,y,vx,vy
color("white")
spot(x,y,8)
rx = x - screen_width / 2
ry = y - screen_height / 2
magsq = rx**2 + ry**2
if magsq != 0:
# normalise
mag = sqrt(magsq)
rx /= mag
ry /= mag
# apply inverse square rule
rx *= g/magsq
ry *= g/magsq
vx -= rx / m
vy -= ry / m
x = x + vx
y = y + vy
color("blue")
drawship(x, y, 0)
开发者ID:jmlowenthal,项目名称:tealight-files,代码行数:28,代码来源:orbits.py
示例12: draw_debug
def draw_debug(self, position = [30, 30], size = [200,200]):
for i in range(0, self.i_size):
for j in range(0, self.j_size):
#Set rgba value based on max value
#Convert to color string "rgba(...)
#Positive values are red, negative are blue
#Values close to zero will be paler
if self.array[i][j] >= 0 :
colour = "red"
else:
colour = "blue"
#Draw box
color(colour)
box(position[0] + j * size[0]/self.j_size,
position[1] + i * size[1]/self.i_size,
size[0]/self.j_size - 1,
size[1]/self.i_size - 1)
#Draw text
color("white")
text(position[0] + j * size[0]/self.j_size,
position[1] + i * size[1]/self.i_size,
str(i) + str(j) + " " + str(self.array[i][j]))
开发者ID:pb471,项目名称:tealight-files,代码行数:26,代码来源:2DArray.py
示例13: DrawGrid
def DrawGrid():
global OffsetX, OffsetY
OffsetX = 0
OffsetY = 0
color("#cccccc")
box(StartingX - 2,StartingY - 2,SquareSize * WLimit + 8,SquareSize * HLimit +8)
for x in range(0,HLimit):
for y in range(0,WLimit):
if VisibleArray[x][y]==0:
DrawCoveredSquare()
elif VisibleArray[x][y] == 1:
DrawUncoveredSquare()
if BombArray[x][y] > 0:
BombNumber = BombArray[x][y]
DrawNumber(x,y,BombNumber)
elif BombArray[x][y] == -1:
if x == lastx and y == lasty:
DrawMine(x,y, "red")
else:
DrawMine(x,y, "black")
elif VisibleArray[x][y] == 2:
DrawFlag(x,y)
OffsetY += SquareSize
OffsetX += SquareSize
OffsetY = 0
开发者ID:davidsamueljones,项目名称:tealight-files,代码行数:25,代码来源:Minesweeper.py
示例14: draw_points
def draw_points(self,points):
global hue
color("hsl(%d,100%%,40%%)" % hue)
hue = hue + 1
line(points[0],points[1],points[2],points[3])
line(points[2],points[3],points[4],points[5])
line(points[4],points[5],points[0],points[1])
开发者ID:c-ryan747,项目名称:tealight-files,代码行数:7,代码来源:racetrack.py
示例15: draw_static_things
def draw_static_things():
blue_top = [(0,0),
(0,screen_height/10),
(screen_width,screen_height/10),
(screen_width,0)]
color("blue")
fill_polygon(blue_top)
开发者ID:c-ryan747,项目名称:tealight-files,代码行数:7,代码来源:racetrack.py
示例16: handle_message
def handle_message(message):
if message["type"] == "reset":
initialPlayer2()
if message["type"] == "line":
color(message["color"])
line(message["x1"], message["y1"], message["x2"], message["y2"])
开发者ID:darkchaoticlord,项目名称:tealight-files,代码行数:7,代码来源:pictionaryPlayer2.py
示例17: draw_polygons
def draw_polygons(self):
color("red")
polygon(self.top_detector)
polygon(self.bottom_detector)
color("blue")
for i in self.polygons:
fill_polygon(i)
开发者ID:c-ryan747,项目名称:tealight-files,代码行数:7,代码来源:racetrack.py
示例18: handle_mousemove
def handle_mousemove(x,y,button):
if button == "right":
color("black")
draw_to(x,y)
elif button == "left":
color("red")
draw_to(x,y)
开发者ID:c-ryan747,项目名称:tealight-files,代码行数:7,代码来源:sketch.py
示例19: handle_mousedown
def handle_mousedown(x,y,button):
global lastx, lasty
if button == "left" and 350 > x > 250 and 350 > y > 250:
color("red")
box(250, 250, 100, 100)
开发者ID:emrecan-k,项目名称:tealight-files,代码行数:7,代码来源:shapes.py
示例20: doSecond
def doSecond():
global points
points = points-1
color("white")
box(0,0,100,100)
color("black")
text(0,0,points)
开发者ID:willg-c,项目名称:tealight-files,代码行数:7,代码来源:points.py
注:本文中的tealight.art.color函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论