本文整理汇总了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)
示例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)
示例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)
示例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()