本文整理汇总了Python中scene.background函数的典型用法代码示例。如果您正苦于以下问题:Python background函数的具体用法?Python background怎么用?Python background使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了background函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: draw
def draw(self):
x,y,z = motion.get_attitude() if use_motion else scene.gravity()
r,g,b = abs(x), abs(y), abs(z)
scene.background(r, g, b)
super(Advice, self).draw()
scene.tint(1-r, 1-g, 1-b)
scene.text(self.answer, 'Futura', 45, *self.center)
开发者ID:Pythonistapro777,项目名称:Python-Scripts,代码行数:7,代码来源:Magic8Ball.py
示例2: draw
def draw(self):
scene.background(0,0,0)
self.root_layer.update(self.dt)
self.root_layer.draw()
scene.fill(1,1,1) # watch+battery -> white background
scene.rect(0, self.bounds.h, self.bounds.w, 20) # watch+battery
locations = [[0,0],[0,0]]
i = 0
if len(self.touches) == 2:
for touch in self.touches.values():
locations[i] = touch.location
i += 1
if self.reset:
self.reset = False
self.distance_old = math.sqrt(math.pow((locations[1][0] - locations[0][0]),2) + pow((locations[1][1] - locations[0][1]),2))
else:
self.distance_new = math.sqrt(math.pow((locations[1][0] - locations[0][0]),2) + pow((locations[1][1] - locations[0][1]),2))
self.distance_abs = self.distance_new - self.distance_old
self.reset = True
if self.distance_abs != 0:
zoom_new = self.distance_abs/self.bounds.w*self.zoom_speed
if zoom_new < 0:
self.zoom += zoom_new
else:
self.zoom += zoom_new
if self.zoom < self.zoom_min:
self.zoom = self.zoom_min
elif self.zoom > self.zoom_max:
self.zoom = self.zoom_max
self.root_layer.animate('scale_x', self.zoom, duration=0.0)
self.root_layer.animate('scale_y', self.zoom, duration=0.0)
开发者ID:buschfsu,项目名称:scene-tutorial,代码行数:31,代码来源:intermediate001-solution.py
示例3: draw
def draw(self):
self.invocations += 1
scene.background(0, 0, 0)
scene.fill(1, 0, 0)
self.active_scene.touches = self.touches
self.active_scene.t = self.t - self.tmp_t
self.active_scene.draw()
开发者ID:c0ns0le,项目名称:Pythonista,代码行数:7,代码来源:main_scene.py
示例4: draw
def draw(self):
portrait = self.size.h > self.size.w
scene.background(0.40, 0.80, 1.00) # light blue background color
if portrait:
self.play_btn_rect = scene.Rect(200, 358, 600, 100)
self.char_btn_rect = scene.Rect(140, 485, 470, 100)
else:
self.play_btn_rect = scene.Rect( 20, 358, 350, 100)
self.char_btn_rect = scene.Rect( 20, 485, 230, 100)
scene.fill(0.50, 1.00, 0.00) # play button fill color
scene.rect(*self.play_btn_rect)
scene.fill(1.00, 1.00, 1.00) # character select button fill color
scene.rect(*self.char_btn_rect)
scene.tint(1.00, 1.00, 1.00) # white text color
fs, x, y = (100, 385, 850) if portrait else (150, 525, 600)
scene.text('Cloud Jump', MENU_FONT, font_size=fs, x=x, y=y)
fs, x, y = ( 65, 380, 650) if portrait else ( 65, 200, 400)
scene.text('Play Game', BUTTON_FONT, font_size=fs, x=x, y=y)
scene.tint(0.00, 0.50, 1.00) # blue text color
fs, x, y = ( 54, 380, 521) if portrait else ( 54, 260, 285)
scene.text('Character Select', BUTTON_FONT, font_size=fs, x=x, y=y)
scene.tint(1.00, 1.00, 1.00) # white text color
fs = 30
if portrait:
x, y = self.bounds.w / 2.0, self.bounds.h / 1.34
else:
x, y = self.bounds.w / 1.4, self.bounds.h / 1.7
s = 'Welcome {}!'.format(player_name)
scene.text(s, MENU_FONT, font_size=fs, x=x, y=y)
for i in xrange(11):
scene.image('PC_Grass_Block', self.bounds.w / 11 * i, 0)
开发者ID:SebastianJarsve,项目名称:Cloud-Jump-2,代码行数:35,代码来源:menu_test.py
示例5: draw
def draw(self):
x,y,z = motion.get_attitude() if use_motion else scene.gravity()
r,g,b = abs(x), abs(y), abs(z) # No negative colors
scene.background(r, g, b)
scene.tint(1-r, 1-g, 1-b)
scene.text(fmt.format(x, y, z), font_size=32,
x=self.center.x, y=self.center.y)
开发者ID:azadel,项目名称:Pythonista_scene,代码行数:7,代码来源:tilting_color.py
示例6: draw
def draw(self):
scene.background(0,0,0)
scene.stroke_weight(4)
for colored_line in self.colored_lines:
scene.stroke(*colored_line.color)
scene.line(*colored_line.line)
开发者ID:Pythonistapro777,项目名称:Python-Scripts,代码行数:7,代码来源:colored_lines.py
示例7: draw
def draw(self):
scene.background(0,0,1) # 0,0,1 = blue
if self.color == 1:
scene.fill(0,1,0) # 0,1,0 = green
elif self.color == 2:
scene.fill(1,0,0) # 1,0,0 = red
scene.rect(50,50,50,50)
开发者ID:c0ns0le,项目名称:Pythonista,代码行数:7,代码来源:beginner005.py
示例8: draw
def draw(self):
scene.background(0,0,1) # 0,0,1 = blue
self.rect1_layer.update(self.dt) # alpha animation
self.rect1_layer.draw() # alpha animation
#scene.fill(0,1,0) # 0,1,0 = green
#scene.ellipse(*self.rect1) # *self.rect1 = self.rect1[0], ..., self.rect1[3]
scene.fill(1,0,0) # 1,0,0 = red
开发者ID:buschfsu,项目名称:scene-tutorial,代码行数:7,代码来源:beginner007.py
示例9: draw
def draw(self):
scene.background(0, 0.5, 1.0)
scene.fill(1, 1, 1)
scene.rect(self.x,self.y, 32, 32) # player
scene.fill(0, 0, 0)
scene.rect(self.x - 70, self.y + 75, 700, 32) # roof
self.floor = scene.rect(self.x - 70, self.y - 75, 700, 32) # floor
print('self.floor is always None:', self.floor)
if not self.grav:
self.acel += 1
#text
scene.tint(0, 0, 0, 1)
if self.dead:
scene.text('You are DEAD', 'Arial', 12, 48, self.y + 16)
else:
self.pts += 1
scene.text('Points: %i' % self.pts, 'Arial', 12, self.x-48, self.y + 32)
# Touch input:
scene.fill(1,0,0)
if not self.grav:
self.acel += 1
# Physics
if not self.dead:
self.y += self.acel
if self.y < self.floor:
self.y = self.floor
self.acel = 0
else:
print('problem: {} > {}'.format(self.y, self.floor))
self.acel -= self.g
self.acel = max(min(self.acel, self.ms), -self.ms)
开发者ID:Pythonistapro777,项目名称:Gravity-Block,代码行数:34,代码来源:Gravity-Block.py
示例10: draw
def draw(self):
scene.background(0.40, 0.80, 1.00)
self.root_layer.update(self.dt)
self.root_layer.draw()
self.cloud.frame.x += 1
if not self.bounds.intersects(self.cloud.frame):
del self.cloud # whack the old cloud
self.setup() # and create a new one
开发者ID:jsbain,项目名称:Cloud-Jump-2,代码行数:8,代码来源:cloud_maker.py
示例11: draw
def draw(self):
self.game_loop()
scene.background(0.40, 0.80, 1.00)
self.root_layer.update(self.dt)
self.root_layer.draw()
for sprite in self.scenery:
sprite.draw()
self.draw_text()
开发者ID:jsbain,项目名称:Cloud-Jump-2,代码行数:8,代码来源:CloudJump2.py
示例12: draw
def draw(self):
scene.background(0.9, 0.9, 0.9)
sx, sy = self.size
mx = 0.5 * (sx - self.wall.bounds.w)
my = 0.5 * (sy - self.wall.bounds.h)
self.wall.move(mx, my)
self.draw_tiles(self.wall.tiles)
self.wall.update()
开发者ID:Vik2015,项目名称:colorwall,代码行数:8,代码来源:colorwall.py
示例13: draw
def draw(self):
scene.background(0, 0, 0)
for c in self.cells.values():
if c.alive:
c.draw()
scene.stroke(1,1,1)
scene.stroke_weight(1)
scene.image(self.grid_img, 0, 0)
开发者ID:c0ns0le,项目名称:Pythonista,代码行数:8,代码来源:life.py
示例14: draw
def draw(self):
scene.background(0, 0, 0)
for i, piece in enumerate(self.pieces):
img = self.img_names[piece.pythonista_gui_imgname]
pos = piece.coord.as_screen()
scene.image(img, pos.x, pos.y, scale_factor, scale_factor)
tpos = Coord(screen_width/2, screen_height/2 + 2*scale_factor)
scene.text('Select a piece to promote to', x=tpos.x, y=tpos.y)
开发者ID:c0ns0le,项目名称:Pythonista,代码行数:8,代码来源:screen_promote.py
示例15: draw
def draw(self):
scene.background(bg_color.r, bg_color.g, bg_color.b)
fg_color = inverse_color(bg_color)
scene.tint(*fg_color) # .r, fg_color.g, fg_color.b)
the_text = fmt.format(*bg_color)
if local_ip_addr: # if remote user has not yet connected
the_text += '\n\n' + ip_fmt.format(local_ip_addr)
scene.text(the_text, font_size=40, x=self.x, y=self.y)
开发者ID:azadel,项目名称:Pythonista_scene,代码行数:8,代码来源:remote_control_scene.py
示例16: draw
def draw(self):
scene.background(0, 0, 0)
self.root_layer.update(self.dt)
self.root_layer.draw()
if not self.frame_count % 180: # once every three seconds
if self.photo_layer.image: # unload old image to save RAM
scene.unload_image(self.photo_layer.image)
self.photo_layer.image = get_random_photo()
self.frame_count += 1
开发者ID:azadel,项目名称:Pythonista_scene,代码行数:9,代码来源:photo_frame.py
示例17: draw
def draw(self):
scene.background(0, 0, 0)
for button in self.buttons:
name, title, value, position, action = button
if action: # toggles have action == None
self.draw_button(title, position)
else:
self.draw_toggle(title, self.data[name], position)
开发者ID:c0ns0le,项目名称:Pythonista,代码行数:9,代码来源:screen_options.py
示例18: draw
def draw(self):
scene.background(0, 0, 0)
for b in self.buttons:
# use '== True' here to avoid catching values like "NA"
if b[2] == True:
self.draw_toggle(b[1], self.data[b[0]], b[3])
elif b[2] in (False, 'NA'):
self.draw_button(b[1], b[3])
开发者ID:c0ns0le,项目名称:Pythonista,代码行数:9,代码来源:screen_options.py
示例19: draw
def draw(self):
scene.background(*color('black'))
self.root_layer.update(self.dt)
self.root_layer.draw()
scene.tint(*self.current_color()) # draw the user's text
scene.text(self.text, self.current_font(), self.fontsize,
self.position[0], self.position[1]+self.btn_height, 5) # add ...position[1]+self.btn_height
scene.fill(*color('white')) # watch+battery -> white background
scene.rect(0, self.bounds.h, self.bounds.w, 20) # watch+battery
开发者ID:c0ns0le,项目名称:Pythonista,代码行数:9,代码来源:photo_text.py
示例20: draw
def draw(self):
scene.background(0, 0, 0)
self.root_layer.update(self.dt)
self.root_layer.draw()
# draw the text
name_text = animal_name(self.current_animal.image)
score_text = "Score: %d" % self.score
w, h = self.size
y = h - 100
scene.text(name_text, font_name=font_name, font_size=72.0, x=w * 0.5, y=y, alignment=5)
scene.text(score_text, font_name=font_name, font_size=24.0, x=w / 20, y=y, alignment=6)
开发者ID:donniewherman,项目名称:Pythonista_scene,代码行数:11,代码来源:AnimalMatchScene.py
注:本文中的scene.background函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论