當前位置: 首頁>>代碼示例>>Python>>正文


Python app.Application類代碼示例

本文整理匯總了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) ]
開發者ID:HampshireCS,項目名稱:cs143-Spring2012,代碼行數:7,代碼來源:main3.py

示例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)
開發者ID:HampshireCS,項目名稱:cs143-Spring2012,代碼行數:32,代碼來源:shiphunt.py

示例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()
開發者ID:yupbank,項目名稱:social_analytic_tool,代碼行數:8,代碼來源:server.py

示例4: __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)
開發者ID:HampshireCS,項目名稱:CS112-Spring2012,代碼行數:11,代碼來源:client.py

示例5: 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)),))
開發者ID:davidfialho14,項目名稱:pico_adapters,代碼行數:8,代碼來源:datataker.py

示例6: 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()
開發者ID:emilio-rst,項目名稱:PySolFC,代碼行數:8,代碼來源:main.py

示例7: __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) ]
開發者ID:altarim992,項目名稱:CS112-Spring2012,代碼行數:8,代碼來源:main.py

示例8: 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=())
開發者ID:davidfialho14,項目名稱:pico_adapters,代碼行數:8,代碼來源:aethalometer.py

示例9: main

def main():
    setup = Setup()
    config = setup.run()

    app = Application(config)
    app.run()

    teardown = Teardown()
    teardown.run()
開發者ID:HarveyK86,項目名稱:PyREST,代碼行數:9,代碼來源:__main__.py

示例10: __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()
開發者ID:abonarrigo621,項目名稱:CS112-Spring2012,代碼行數:10,代碼來源:main.py

示例11: 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()
開發者ID:Grug16,項目名稱:Save-the-Robots-Game,代碼行數:11,代碼來源:game.py

示例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)]
開發者ID:jwsander,項目名稱:CS112-Spring2012,代碼行數:12,代碼來源:main.py

示例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)
開發者ID:jmechnich,項目名稱:appletlib,代碼行數:15,代碼來源:systray.py

示例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()
開發者ID:13788593535,項目名稱:machinekit,代碼行數:17,代碼來源:main.py

示例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")
開發者ID:EricPobot,項目名稱:youpinitel-v1-raspi,代碼行數:45,代碼來源:entry_points.py


注:本文中的app.Application類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。