本文整理汇总了Python中scene.run函数的典型用法代码示例。如果您正苦于以下问题:Python run函数的具体用法?Python run怎么用?Python run使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
self.scenes = [scn for scn in find_scenes()]
assert self.scenes, "No Scene files found!"
print("{} scenes imported: {}".format(len(self.scenes), self.scenes))
self.scene_index = -1
self.switch_scenes()
scene.run(self, orientation=scene.LANDSCAPE)
示例2: __init__
def __init__(self):
self.img2 = photos.pick_image()
self.img = self.img2.convert('RGBA') #fix for current scene.load_pil_image()
if self.img:
self.picsize = scene.Size(*self.img.size)
scene.run(self)
else:
print('Good bye!')
示例3: __init__
def __init__(self):
self.text = raw_input('Text to insert in the picture [Hello]: ') or 'Hello'
self.position = None
self.fontnr = 0 # Helvetica
self.colornr = 3 # red
self.fontsize = 48.0 # 48 point
self.img2 = photos.pick_image()
self.img = self.img2.convert('RGBA') #fix for current scene.load_pil_image()
self.picsize = scene.Size(*self.img.size)
self.btn_height = 0
if self.img:
scene.run(self, frame_interval=3) # save battery with less frame rates -> 3 = 20fps
else:
print('Good bye!')
示例4: __init__
def __init__(self):
self.distance_old = 0.0
self.distance_new = 0.0
self.distance_abs = 0.0
self.reset = True
self.zoom = 1.0 #no zoom
self.zoom_min = 0.5
self.zoom_max = 5
self.zoom_speed = 3
self.img2 = photos.pick_image()
self.img = self.img2.convert('RGBA') #fix for current scene.load_pil_image()
if self.img:
self.picsize = scene.Size(*self.img.size)
scene.run(self)
else:
print('Good bye!')
示例5: __init__
def __init__(self):
self.text = raw_input('Text to insert in the picture [Hello]: ') or 'Hello'
self.position = None
self.fontnr = 0 # Helvetica
self.colornr = 3 # red
self.fontsize = 48.0 # 48 point
self.img = photos.pick_image()
self.picsize = scene.Size(*self.img.size)
if self.picsize.h > self.picsize.w:
print('Sorry at the moment only landscape or square pictures are supported!')
self.img = None
self.picborder = None
self.btn_height = 0
if self.img:
scene.run(self)
else:
print('Good bye!')
示例6: run
def run(game, frame_delay=1):
game.conf()
if not gamepie.isPieSupported(game.gamepie):
game = gamepie.ErrorPie(
"Target GamePie version is not supported: %s" % game.gamepie)
for module in __required__:
setattr(gamepie, module,
importlib.import_module("gamepie." + module))
if not "graphics" in __required__:
# We need this module any way
setattr(gamepie, "graphics",
importlib.import_module("gamepie.graphics"))
gamepie.graphics.setSetting("width", game.size[0])
gamepie.graphics.setSetting("height", game.size[1])
scene.run(PieScene(game), frame_interval=frame_delay)
示例7: gui
def gui(self):
"""Spawn a GUI for the game. **Only works in Pythonista, on other platforms does nothing."""
from Phantom.constants import in_pythonista
if in_pythonista:
from Phantom.gui_pythonista.main_scene import MultiScene
from Phantom.gui_pythonista.screen_main import ChessMainScreen
from Phantom.gui_pythonista.screen_loading import ChessLoadingScreen
from Phantom.gui_pythonista.screen_options import ChessOptionsScreen
from Phantom.gui_pythonista.screen_promote import ChessPromoteScreen
self.data['screen_main'] = ChessMainScreen(self)
self.data['screen_load'] = ChessLoadingScreen()
self.data['screen_options'] = ChessOptionsScreen(self)
self.data['screen_promote'] = ChessPromoteScreen(self)
self.data['main_scene'] = MultiScene(self.data['screen_load'])
self.data['screen_main'].set_parent(self.data['main_scene'])
self.data['screen_load'].set_parent(self.data['main_scene'])
self.data['screen_options'].set_parent(self.data['main_scene'])
self.data['screen_promote'].set_parent(self.data['main_scene'])
self.data['main_scene'].switch_scene(self.data['screen_load'])
import scene
scene.run(self.data['main_scene'])
示例8: main
def main():
scene = Scene()
ui.run(scene)
示例9: Coord
pos = Coord(896, turn_y)
size = Coord(scale_factor / 2, scale_factor / 2)
scene.tint(1, 1, 1, 1)
scene.image(self.turn_indicator_img, pos.x, pos.y, size.x, size.y)
scene.tint(1, 1, 1, 1)
if self.won:
pos = Coord(self.size.w/2, self.size.h/2)
scene.tint(0.32645,0.28306,0.93492)
# commented out until the bug in ChessGame.is_won() is fixed to be
# less annoying
scene.text('{} wins'.format(self.won), x=pos.x, y=pos.y, font_size=40.0)
scene.tint(1, 1, 1, 1)
# Buttons
scene.text('AI Easy', x=scale_factor/2, y=scale_factor*6 - scale_factor/2)
scene.text('AI Hard', x=scale_factor/2, y=scale_factor*5 - scale_factor/2)
scene.text('Get score', x=scale_factor/2, y=scale_factor*4 - scale_factor/2)
if self.disp_score:
scene.text(str(self.pos_score), x=scale_factor/2, y=scale_factor*4 - scale_factor/1.5)
scene.text('Undo', x=scale_factor/2, y=scale_factor*3 - scale_factor/2)
scene.text('Deselect', x=scale_factor/2, y=scale_factor*2 - scale_factor/2)
scene.text('Options', x=scale_factor/2, y=scale_factor*7 - scale_factor/2)
if __name__ == '__main__':
from Phantom.core.game_class import ChessGame, loadgame
game = ChessGame() #loadgame('Long Endgame 1')
game.board.cfg.disp_sqrs = True
s = ChessMainScreen(game)
scene.run(s)
示例10: animate
def animate(wall, *args, **kwargs):
anim = Scene()
anim.do_setup(wall)
scene.run(anim, *args, **kwargs)
示例11: key_down
im = scene.load_image_file('white_rectangle_512_512.png')
self.sprite_node = scene.SpriteNode(im, position=(400,400),
size=(96, 64),
parent=self)
self.sprite_node.shader = scene.Shader(fragment_shader_text)
def key_down(self, key):
if key.key_val == pyglet.window.key.RIGHT:
self.sprite_node.position = ((self.sprite_node.position[0]+10)%self.size[0],
self.sprite_node.position[1])
elif key.key_val == pyglet.window.key.LEFT:
self.sprite_node.position = ((self.size[0]+self.sprite_node.position[0]-10)%self.size[0],
self.sprite_node.position[1])
elif key.key_val == pyglet.window.key.UP:
self.sprite_node.position = (self.sprite_node.position[0],
(self.sprite_node.position[1]+10)%self.size[1])
elif key.key_val == pyglet.window.key.DOWN:
self.sprite_node.position = (self.sprite_node.position[0],
(self.size[0]+self.sprite_node.position[1]-10)%self.size[1])
#else:
# self.label.text = "Key pressed %s" % chr(key.key_val)
def touch_began(self, touch):
self.sprite_node.position = touch.location
def touch_moved(self, touch):
self.sprite_node.position = touch.location
scene.run(MyScene(screen_width=800, screen_height=800))
示例12: len
else :
y=r[self.idx%Nr].data()
# start idx, stop idx+1
r[self.idx%Nr].record()
#stop recorder a few samples before im ready to read it
lookaheadidx=self.idx+1+int(0.25//(T/(Nr-1)))
r[lookaheadidx%Nr].stop()
self.idx+=1
if len(y)==0:
return
for i,n in enumerate(self.v):
iy=int(i/Np*len(y))
n.position=(i/Np*W,y[iy]*H+H/2)
def did_stop(self):
print 'stopping'
#raise Error()
self['n'][0].remove_all_actions()
[rec.stop() for rec in r]
ui.delay(cleanup,0.25)
# the scene seems to crash when restarting, unless we raise an error here
raise KeyboardInterrupt
#sc=Vis(dofft=True)
sc=Vis(dofft=False)
sc.shows_fps=True
sc.shows_node_count=True
scene.run(sc)
示例13: __init__
def __init__(self):
scene.run(self)
示例14: range
except:
wx=wy=wz=sx=sy=sz=.5
ue=(-wx,-wy,-wz)
un=(sx,sy,sz)
uu=(-gx,-gy,-gz)
physvert=[None for i in range(8)]
for j in range(8):
i=cvert[j]
cx=i[0]*ue[0]+i[1]*un[0]+i[2]*uu[0]
cy=i[0]*ue[1]+i[1]*un[1]+i[2]*uu[1]
cz=i[0]*ue[2]+i[1]*un[2]+i[2]*uu[2]
physvert[j]=[cx,cy,cz]
faces=((2,3,6,7,'#ff6060'),(0,1,4,5,'#a00000'),(0,3,4,7,'#60ff60'),(1,2,5,6,'#00a000'),(0,1,3,2,'#6060ff'),(4,5,7,6,'#0000a0'))
faceord=sorted([0,1,2,3,4,5],key=lambda t: sum([physvert[n][2] for n in faces[t][:4]]))
visvert=[]
D=4*self.size.width*.5/(.61*19.8)
centx,centy=self.size/2
for i in physvert:
x,y,z=i
rad=D*20/(65-z)
visvert.append((rad*x+centx,rad*y+centy))
for i in faceord:
scene_drawing.fill(faces[i][4])
scene_drawing.triangle_strip([visvert[j] for j in faces[i][:4]])
def stop(self):
stop_updates()
if __name__=='__main__':
scene.run(quubcam(),scene.PORTRAIT,show_fps=True)
示例15: MyClass
import scene
class MyClass(scene.Scene):
def draw(self):
# this method draws 60 times per second the blue background, if you don't change it
scene.background(0,0,1) # 0,0,1 = blue
scene.run(MyClass())