Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Kivy-Working-Examples/45 RPM Record Rotation Using Scatter.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
38 lines (35 sloc)
1.11 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Modified from https://gist.github.com/tshirtman/6222891 | |
import kivy | |
from kivy.app import App | |
from kivy.properties import NumericProperty | |
from kivy.lang import Builder | |
from kivy.clock import Clock | |
kivy.require("1.9.1") # used to alert user if this code is run on an earlier version of Kivy. | |
kv = """ | |
BoxLayout: | |
Widget: | |
# Gray background | |
canvas.before: | |
BorderImage: | |
source: 'background.png' | |
pos: self.pos | |
size: self.size | |
Scatter: | |
center: self.parent.center | |
do_rotation: False | |
do_translation: False | |
do_scale: False | |
rotation: app.angle | |
scale: min(self.parent.width/self.width, self.parent.height/self.height) | |
Image: | |
source: 'new.png' | |
""" | |
class RotateRecordApp(App): | |
angle = NumericProperty(0) | |
def build(self): | |
Clock.schedule_interval(self.update_angle, 0) | |
return Builder.load_string(kv) | |
def update_angle(self, dt, *args): | |
self.angle -= dt * 175 | |
if __name__ == '__main__': | |
RotateRecordApp().run() |