本文整理汇总了Python中tealight.art.box函数的典型用法代码示例。如果您正苦于以下问题:Python box函数的具体用法?Python box怎么用?Python box使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了box函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: 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
示例2: doSecond
def doSecond():
global points
points = points-1
color("white")
box(0,0,100,100)
color("black")
text(0,0,points)
示例3: findMines
def findMines():
global mine
for i in range(0, 10):
for j in range(0, 10):
if get(mine, i, j) == 1:
color('red')
box(i*60,j*60,50,50)
示例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"]
示例5: handle_frame
def handle_frame():
sleep(30)
global phi, theta, alpha, dphi, dtheta, dalpha
phi=phi+dphi
theta=theta+dtheta
alpha=alpha+dalpha
color("white")
box(0,0,screen_width,screen_height)
color("black")
linethree(-100,-100,-100,100,-100,-100)
linethree(100,-100,-100,100,-100,100)
linethree(100,-100,100,-100,-100,100)
linethree(-100,-100,-100,-100,-100,100)
linethree(-100,100,-100,100,100,-100)
linethree(100,100,-100,100,100,100)
linethree(100,100,100,-100,100,100)
linethree(-100,100,-100,-100,100,100)
linethree(-100,-100,-100,-100,100,-100)
linethree(-100,-100,100,-100,100,100)
linethree(100,-100,100,100,100,100)
linethree(100,-100,-100,100,100,-100)
示例6: 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
示例7: 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)
示例8: 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]))
示例9: 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)
示例10: makegrid
def makegrid():
for j in range(0, 10):
for i in range(0, 10):
if((i+j) % 2) !=1:
color("black")
else:
color("blue")
box(i*60, j*60, 50, 50)
示例11: DrawFlag
def DrawFlag(x,y):
global SquareSize
DrawCoveredSquare()
BoxSize = SquareSize/3
color("gold")
box(StartingX + SquareSize * x + SquareSize/2 - BoxSize/2,StartingY + SquareSize * y + SquareSize/2 - BoxSize/2, SquareSize/3,SquareSize/3)
color("orange")
rectangle(StartingX + SquareSize * x + SquareSize/2 - BoxSize/2,StartingY + SquareSize * y + SquareSize/2 - BoxSize/2, SquareSize/3,SquareSize/3)
示例12: __init__
def __init__(self):
self.polygons = []
self.top = []
color("white")
box(0,screen_height/10,screen_width,screen_height)
self.create_polygons()
self.draw_polygons()
示例13: doSecond
def doSecond():
global points
points = points - 1
color("white")
box(0,screen_height - 100, 100, 100)
color("black")
if points < 0:
points = 0
text(10,screen_height - 30, ("Points: " + str(points)))
示例14: handle_frame
def handle_frame():
global car1, car2, leftPressed, rightPressed, upPressed, downPressed, aPressed, sPressed, dPressed, wPressed, explosions, explosionCount
color("white")
box(0, 0, screen_width, screen_height)
color("red")
if leftPressed:
car1.change_orientation(4)
elif rightPressed:
car1.change_orientation(-4)
elif upPressed:
car1.Acceleration += 0.01
if car1.Acceleration > 0.05:
car1.Acceleration = 0.05
elif downPressed:
if car1.Acceleration == 0:
if car1.Acceleration < -0.05:
car1.Acceleration = -0.05
else:
car1.Acceleration -= 0.01
if aPressed:
car2.change_orientation(4)
elif dPressed:
car2.change_orientation(-4)
elif wPressed:
car2.Acceleration += 0.01
if car2.Acceleration > 0.05:
car2.Acceleration = 0.05
elif sPressed:
if car2.Acceleration == 0:
if car2.Acceleration < -0.05:
car2.Acceleration = -0.05
else:
car2.Acceleration -= 0.01
car1.update_speed()
car2.update_speed()
testCollisions()
car1.draw_car("Foo")
car2.draw_car("Bar")
for i in range(0, explosionCount):
if explosions[i] != None:
if explosions[i].draw():
explosions[i] = None
# for i in range (0, len(otherCars)): #Draw connected players cars
# otherCars[i].draw()
#Draw the map
color("green")
rectangle(outerWallX, outerWallY, outerWallWidth, outerWallHeight)
示例15: DrawBomb
def DrawBomb(x,y):
color("red")
box(x*34+182,y*34+202,32,32)
centrex = 199 + 34 * x
centrey = 219 + 34 * y
color("black")
spot(centrex,centrey,10)