当前位置: 首页>>代码示例>>Python>>正文


Python Framework.__init__方法代码示例

本文整理汇总了Python中framework.Framework.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Framework.__init__方法的具体用法?Python Framework.__init__怎么用?Python Framework.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在framework.Framework的用法示例。


在下文中一共展示了Framework.__init__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from framework import Framework [as 别名]
# 或者: from framework.Framework import __init__ [as 别名]
    def __init__(self, gui):
        Framework.__init__(self, gui)

        ground = self.world.create_body()

        body = self.world.create_static_body(
            position=(0, -8),
            allow_sleep=False,
            shape_fixture=b2d.fixture_def(density=5.0),
            shapes=[
                b2d.polygon_shape((0.5, 10), (10, 0), 0),
                b2d.polygon_shape((0.5, 10), (-10, 0), 0),
                b2d.polygon_shape((10, 0.5), (0, 10), 0),
                b2d.polygon_shape((10, 0.5), (0, -10), 0),
            ]
        )

        pdef = b2d.particle_system_def(viscous_strength=100,spring_strength=0.0)
        self.psystem = self.world.create_particle_system(pdef)
        self.psystem.radius = 0.3
        self.psystem.damping = 0.2


        pgDef = b2d.particle_group_def(flags=b2d.ParticleFlag.waterParticle, 
                                      group_flags=b2d.ParticleGroupFlag.solidParticleGroup,
                                     strength=0.0)

        self.group = self.psystem.create_particle_group(pgDef)
开发者ID:,项目名称:,代码行数:30,代码来源:

示例2: __init__

# 需要导入模块: from framework import Framework [as 别名]
# 或者: from framework.Framework import __init__ [as 别名]
    def __init__(self):
        Framework.__init__(self)
        
        world = self.world

        ground = world.create_static_body(shapes=b2.Edge((-20, 0),( 20, 0))) 

        controller = world.create_buoyancy_controller(
                                        offset=15, normal=(0, 1), density=2, 
                                        linear_drag=2, angular_drag=1)
       
        # Create a few spheres to bob around
        for i in range(7):
            body = self.world.create_dynamic_body(
                    position=(-10+4.0*i, 20), 
                    fixtures=b2.Fixture(shape=b2.Circle(radius=1.0), 
                                density=1.0)
                    )

            controller.add_body(body)

        # Create a bridge, and add it to the controller
        num_planks = 30
        plank_bodies = create_bridge(self.world, ground, (1.0, 0.25), (-14.5, 5), num_planks, 0.2, 1)
        for body in plank_bodies:
            controller.add_body(body)

        # Create a circle underneath the bridge
        body = self.world.create_dynamic_body(
                position=(-10.0, 0), 
                fixtures=b2.Fixture(shape=b2.Circle(radius=1.0), 
                            density=1.0)
                )

        controller.add_body(body)

        # And finally, some triangles
        for i in range(5):
            body = self.world.create_dynamic_body(
                    position=(-10+3.0*i, 20), 
                    fixtures=b2.Fixture(
                                shape=b2.Polygon(
                                    vertices=[(-0.5,0),(0,-0.5),(0.5, 0.0)]),
                                density=1.0)
                    )

            controller.add_body(body)

        # And (really) finally this time, just something so we can be sure 
        # edges work, too.
        edge = world.create_dynamic_body(
                    fixtures=b2.Fixture(shape=b2.Edge((5, 0),(5, 3)),
                                density=1.0)
                    )
        controller.add_body(edge)
开发者ID:shengtu,项目名称:pypybox2d,代码行数:57,代码来源:buoyancy.py

示例3: __init__

# 需要导入模块: from framework import Framework [as 别名]
# 或者: from framework.Framework import __init__ [as 别名]
    def __init__(self):
        Framework.__init__(self)
        
        world = self.world

        # Turn off normal gravity
        world.gravity = (0, 0)

        ground = world.create_static_body(shapes=b2.Edge((-20, 0),( 20, 0))) 

        controller = world.create_gravity_controller(G=0.8, inv_sqr=True)
       
        # Create a few spheres to bob around
        for i in range(1,4):
            body = self.world.create_dynamic_body(
                    position=(0.25 * i, 2.0 + 7.5 * i),
                    fixtures=b2.Fixture(shape=b2.Circle(radius=0.25 * i), 
                                density=1.0),
                    bullet=True,
                    )

            controller.add_body(body)

        # Create a bridge, and add it to the controller
        num_planks = 30
        plank_bodies = create_bridge(self.world, ground, (1.0, 0.25), (-14.5, 5), num_planks, 0.2, 10)
        for body in plank_bodies:
            controller.add_body(body)

        # Create a circle underneath the bridge
        body = self.world.create_dynamic_body(
                position=(-10.0, 0), 
                fixtures=b2.Fixture(shape=b2.Circle(radius=1.0), 
                            density=10.0)
                )

        controller.add_body(body)

        # And finally, some triangles
        for i in range(5):
            body = self.world.create_dynamic_body(
                    position=(-10+3.0*i, 20), 
                    fixtures=b2.Fixture(shape=b2.Polygon(vertices=[(-0.5,0),(0,-0.5),(0.5, 0.0)]),
                                density=1.0)
                    )

            controller.add_body(body)
开发者ID:shengtu,项目名称:pypybox2d,代码行数:49,代码来源:gravity_bridge.py

示例4: __init__

# 需要导入模块: from framework import Framework [as 别名]
# 或者: from framework.Framework import __init__ [as 别名]
    def __init__(self, framework, method=None):
        super(Params, self).__init__()
        Framework.__init__(self, framework)

        self.method = method
        self.protpred_param = []
        self.protpred_eda_param = []
        self.meamt_param = []
        self.rw_param = []
        self.mcm_param = []
        self.ga_param = []
        self.rboa_param = []
        self.de_param = []
        self.eda_param = []
        self.ceda_param = []
        self.fgm_param = []

        self.__build_param_lists()
开发者ID:leobiscassi,项目名称:koala-server,代码行数:20,代码来源:params.py


注:本文中的framework.Framework.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。