本文整理汇总了Python中group.Group.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Group.__init__方法的具体用法?Python Group.__init__怎么用?Python Group.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类group.Group
的用法示例。
在下文中一共展示了Group.__init__方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from group import Group [as 别名]
# 或者: from group.Group import __init__ [as 别名]
def __init__(self, parent, religion, from_city, destination_city, has_boat):
self.from_city = from_city
self.destination_city = destination_city
self.religion = religion
self.resources_sent = {}
# Find out what they need
resource_diff = from_city.get_resource_differences(destination_city)
for resource in resource_diff:
if resource_diff[resource] > 0:
self.resources_sent[resource] = random.randint(1, int(resource_diff[resource]))
# This is to ensure that all caravans make at least some money
self.resources_sent['trade_goods'] = random.randint(1, int(math.log(from_city.population)) ** 2 + 1)
# Set up the rest of the information we need to be a proper group object
Group.__init__(self, parent, 'caravan', (religion, self.resources_sent), from_city.position,
destination_city.position, from_city.nation.color, lambda _: False,
self.receive_caravan, has_boat)
示例2: __init__
# 需要导入模块: from group import Group [as 别名]
# 或者: from group.Group import __init__ [as 别名]
def __init__(self, content=None, parent=None):
Group.__init__(self, content, parent)
self._viewport = Viewport(content)
示例3: __init__
# 需要导入模块: from group import Group [as 别名]
# 或者: from group.Group import __init__ [as 别名]
def __init__(self):
Group.__init__(self)