Skip to content

Instantly share code, notes, and snippets.

@yihuang
Created December 6, 2013 13:40
Show Gist options
  • Select an option

  • Save yihuang/7823983 to your computer and use it in GitHub Desktop.

Select an option

Save yihuang/7823983 to your computer and use it in GitHub Desktop.
kivy strange behaviour, child widget don't move with parent widget.
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()
#: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