本文整理汇总了Python中kivy.uix.image.Image.center方法的典型用法代码示例。如果您正苦于以下问题:Python Image.center方法的具体用法?Python Image.center怎么用?Python Image.center使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.uix.image.Image
的用法示例。
在下文中一共展示了Image.center方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: level_accomplished
# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import center [as 别名]
def level_accomplished(self):
self.app.sound['accomplished'].play()
# store score in config: (i have to convert the string to a list to do specific char writing)
levels_before = list(self.app.config.get('GamePlay', 'Levels'))
levels_before[self.level - 1] = '1'
self.app.config.set('GamePlay', 'Levels', "".join(levels_before))
self.app.config.write()
# show up a little image with animation: size*2 and out_bounce and the wait 1 sec
image = Image(source='graphics/accomplished.png', size_hint=(None, None), size=(200, 200))
image.center=self.center
animation = Animation(size=(350, 416), duration=1, t='out_bounce')
animation &= Animation(center=self.center, duration=1, t='out_bounce')
animation += Animation(size=(350, 416), duration=1) # little hack to sleep for 1 sec
self.add_widget(image)
animation.start(image)
animation.bind(on_complete=self.accomplished_animation_complete)
示例2: primary_image
# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import center [as 别名]
def primary_image(self):
frac = 0.3
img = Image(source='img/sun/generic_sun.png',color=self.color,mipmap=True,center=self.location.tolist(),allow_stretch=False,size_hint=(None, None),size=(round(75*frac*self.radius), round(75*frac*self.radius)))
img.center=self.location.tolist()
return img