本文整理汇总了Python中app.Application类的典型用法代码示例。如果您正苦于以下问题:Python Application类的具体用法?Python Application怎么用?Python Application使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Application类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
Application.__init__(self)
self.bounds = self.screen.get_rect()
self.ships = Group()
self.spawners = [ TieSpawner(2000, self.ships, self.bounds) ]
示例2: __init__
def __init__(self):
pygame.init()
#self.screen_size = pygame.display.list_modes()[0]
Application.__init__(self)
#pygame.display.toggle_fullscreen()
self.ships = ShipGroup(self.max_ships)
self.xplos = ExplosionGroup()
self.screen_bounds = bounds = self.screen.get_rect()
dc_height = 40
self.dc_font = pygame.font.Font(None, 30)
self.dc_bounds = Rect(0, bounds.height - dc_height, bounds.width, dc_height)
self.game_bounds = Rect(0, 0, bounds.width, bounds.height - dc_height)
spawn_area = self.game_bounds.inflate(-self.game_bounds.width/4, -self.game_bounds.height/4)
self.spawners = [
TieSpawner(1000, self.ships, self.game_bounds, spawn_area),
YWingSpawner(2000, self.ships, self.game_bounds)
]
self.detonator = Detonator(self.game_bounds, self.xplos)
for spawner in self.spawners:
spawner.spawn()
Ship.death_count = DeathCount()
self.current_weapon = MiniExplosionsWeapon(self)
示例3: main
def main():
tornado.options.parse_command_line()
app = Application()
app.listen(options.port)
print "start on port %s..."%options.port
instance = tornado.ioloop.IOLoop.instance()
tornado.autoreload.start(instance)
instance.start()
示例4: main
def main():
app = Application(args=docopt(__doc__))
config = app.load_config(DataTakerConfiguration)
app.run(decoder=DataTakerDecoder,
data_handlers=(DataTakerDataStorer(config.store_dir,
config.backup_dir),),
connection_handlers=((DataTakerConnectionHandler(config.cmd_file)),))
示例5: main
def main(args=None):
# create the application
app = Application()
r = pysol_init(app, args)
if r != 0:
return r
# let's go - enter the mainloop
app.mainloop()
示例6: __init__
def __init__(self):
Application.__init__(self)
self.bounds = self.screen.get_rect()
self.ships = ShipGroup(self.max_ships)
self.spawners = [ TieSpawner(2000, self.ships, self.bounds),
YWingSpawner(2000, self.ships, self.bounds) ]
示例7: main
def main():
app = Application(args=docopt(__doc__))
config = app.load_config(AethalometerConfiguration)
app.run(decoder=AethalometerDecoder,
data_handlers=(AethalometerDataStorer(config.store_dir,
config.backup_dir),),
connection_handlers=())
示例8: main
def main():
setup = Setup()
config = setup.run()
app = Application(config)
app.run()
teardown = Teardown()
teardown.run()
示例9: __init__
def __init__(self):
#initialize Application
Application.__init__(self)
self.bounds = self.screen.get_rect()
#won't produce more than max_ships
self.ships = ShipGroup(self.max_ships) #Sprite Group, makes sprite fxn (collision) easier
self. spawners = [ TieSpawner(1000, self.ships, self.bounds),
YWingSpawner(2000, self.ships, self.bounds)]
self.xplos = ExplosionGroup()
示例10: main
def main():
# initialize pygame
pygame.init()
pygame.display.set_mode((800, 600))
# create game
app = Application(Instruction)
try:
app.run()
except KeyboardInterrupt:
app.quit()
示例11: __init__
def __init__(self, options):
pygame.init()
pygame.display.set_mode(settings.SCREEN_SIZE)
pygame.display.set_caption(settings.CAPTION)
self.nick = options["nick"]
self.addr = options["addr"]
self.port = options["port"]
self.factory = NetworkControllerFactory(self)
Application.__init__(self, ConnectingState)
示例12: __init__
def __init__(self):
Application.__init__(self)
self.bounds = self.screen.get_rect()
self.ships = ShipGroup(self.max_ships)
self.bullets = ShipGroup(self.max_ships)
self.xplos = ExplosionGroup()
self.score = 0
self.player = Player(400, 560, 20, 20, self.bounds, (255, 255, 255))
Explosion.group = self.xplos
self.spawners = [TieSpawner(1000, self.ships, self.bounds), YWingSpawner(2000, self.ships, self.bounds)]
示例13: __init__
def __init__(self,name,interval=1000):
super(SystemTrayIcon,self).__init__()
self.fgColor = QColor(
Application.settingsValue("fgColor", QColor("#33b0dc")))
self.bgColor = QColor(
Application.settingsValue("bgColor", QColor("#144556")))
self.interval = Application.settingsValue(
"%s/interval" % name, interval).toInt()[0]
pix = QPixmap(22,22)
p = QPainter(pix)
p.fillRect(pix.rect(), Qt.black)
p.end()
self.setIcon(QIcon(pix))
self.startTimer( self.interval)
示例14: main
def main():
usage = "usage: %prog [-c CRAPFILE] | [CRAPFILE]"
parser = OptionParser(usage)
(options, args) = parser.parse_args()
if len(args) > 1:
parser.error("incorrect number of arguments")
app = Application()
if len(args):
file_load(app.design, args[0])
app.show_app()
gtk.main()
else:
app.design.update()
app.show_app()
gtk.main()
示例15: demo_main
def demo_main():
script_basename = "youpinitel-demo"
cfg_home = "/etc" if os.getuid() == 0 else ".youpinitel"
parser = argparse.ArgumentParser(description="Youpi + Minitel demonstration")
parser.add_argument(
"-m",
"--minitel-port",
help="device to which the Minitel is connected (default: %(default)s)",
dest="minitel_port",
default="/dev/ttyUSB0",
)
parser.add_argument("-p", "--arm-port", help="device to which the arm interface is connected", dest="arm_port")
parser.add_argument("-b", "--arm-busname", help="nROS bus name of the arm controller", dest="arm_busname")
parser.add_argument(
"-c",
"--config-file",
help="configuration file (default: %(default)s)",
dest="config_file",
type=file,
default=os.path.join(cfg_home, "%s.json" % script_basename),
)
parser.add_argument("-d", "--debug", help="activates debug trace", action="store_true")
args = parser.parse_args()
try:
app = Application(log=logging.getLogger("app"), **args.__dict__)
except Exception as e:
if args.debug:
logging.exception("unexpected error")
logging.getLogger().fatal("unable to initialize application instance (%s)", e)
else:
try:
app.run()
except Exception as e:
if args.debug:
logging.exception("unexpected error")
else:
# logging.getLogger().fatal('unexpected error : (%s) %s', e.__class__.__name__, e)
logging.getLogger().exception(e)
else:
logging.getLogger().info("application terminated")