擅长:python、mysql、java
<p>to to-tico前面的2个答案是一种方法,但是我宁愿为它创建一个新的小部件,并使用它:</p>
<pre><code>Builder.load_string('''
<RotatedImage>:
canvas.before:
PushMatrix
Rotate:
angle: root.angle
axis: 0, 0, 1
origin: root.center
canvas.after:
PopMatrix
''')
class RotatedImage(Image):
angle = NumericProperty()
</code></pre>
<p>然后,将此小部件用作其他图像小部件,您只需拥有一个可以使用的“角度”属性。</p>
<p>注意:除了在散射示例中,碰撞检测不会在图像上处理。仅仅为了旋转一些东西,散射可能很昂贵,但至少碰撞是有效的。</p>