Created
December 6, 2013 13:40
-
-
Save yihuang/7823983 to your computer and use it in GitHub Desktop.
kivy strange behaviour, child widget don't move with parent widget.
This file contains hidden or 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
| from kivy.app import App | |
| from kivy.uix.widget import Widget | |
| from kivy.clock import Clock | |
| class PongGame(Widget): | |
| def __init__(self, **kwargs): | |
| super(PongGame, self).__init__(**kwargs) | |
| Clock.schedule_interval(self.move, 1 / 60.) | |
| def move(self, *args): | |
| self.x += 1 | |
| class PongApp(App): | |
| def build(self): | |
| return PongGame() | |
| if __name__ == '__main__': | |
| PongApp().run() |
This file contains hidden or 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
| #:kivy 1.0.9 | |
| <PongGame>: | |
| canvas: | |
| Rotate: | |
| angle: 20 | |
| Rectangle: | |
| pos: self.pos | |
| size: self.size | |
| sub_window: sub_window | |
| RelativeLayout: | |
| Widget: | |
| id: sub_window | |
| canvas: | |
| Color: | |
| rgba: 1,0,0,1 | |
| Rectangle: | |
| pos: self.pos | |
| size: self.size |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment