本文整理汇总了Python中kivy.uix.image.Image.setter方法的典型用法代码示例。如果您正苦于以下问题:Python Image.setter方法的具体用法?Python Image.setter怎么用?Python Image.setter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.uix.image.Image
的用法示例。
在下文中一共展示了Image.setter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AnimationController
# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import setter [as 别名]
class AnimationController(Widget):
mStartingAnimation = StringProperty("")
_CurrentImage = ObjectProperty(None)
def __init__(self, **kwargs):
super(AnimationController, self).__init__(**kwargs)
self.mAnimations = {}
self._CurrentAnimation = None
def add_widget(self, widget):
super(AnimationController, self).add_widget(widget)
def InitializeAnimation(self, inAnimationWidget):
animationID = inAnimationWidget.mID
print (animationID)
assert not animationID in self.mAnimations
if (not animationID in self.mAnimations):
print ("Initializing Animation %s" % animationID)
inAnimationWidget.Initialize()
self.mAnimations[animationID] = inAnimationWidget
def PlayAnimationByName(self, inAnimationName):
assert inAnimationName in self.mAnimations, "No animation named " + inAnimationName
if (inAnimationName in self.mAnimations):
if (self._CurrentAnimation != None):
self._CurrentAnimation.Stop()
self._CurrentAnimation = self.mAnimations[inAnimationName]
print ("New Animation: ", self._CurrentAnimation)
self._CurrentAnimation.Start()
self._CurrentImage.texture = self._CurrentAnimation.mCurrentTextureArea
print ("Current image: ", self._CurrentImage)
def Initialize(self, inOwner):
for currentChild in self.children:
if isinstance(currentChild, AnimationGraphic):
print ("Scheduling animaton add")
self.InitializeAnimation(currentChild)
self._CurrentImage = Image(pos=inOwner.pos)
self.bind(pos=self._CurrentImage.setter('pos'))
self.add_widget(self._CurrentImage)
self.PlayAnimationByName(self.mStartingAnimation)
def Update(self, dt):
if (self._CurrentAnimation != None):
self._CurrentAnimation.Update(dt)
self._CurrentImage.texture = self._CurrentAnimation.mCurrentTextureArea