Skip to content

Instantly share code, notes, and snippets.

@Exodus111
Created June 19, 2017 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Exodus111/0662a52f9942a29828a7c5d83c5f078e to your computer and use it in GitHub Desktop.
Save Exodus111/0662a52f9942a29828a7c5d83c5f078e to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
import kivy
kivy.require("1.9.0")
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.image import Image
from kivy.graphics import Rectangle
from kivy.clock import Clock
from kivy.properties import ObjectProperty
class Main(Widget):
foreground = ObjectProperty(None)
background = ObjectProperty(None)
def setup(self):
with self.canvas:
Rectangle(texture=self.background.texture, pos=[200,200], size_hint_x=None, size_hint_y=None, size=[800, 800])
Rectangle(texture=self.foreground.texture, pos=[200,200], size_hint_x=None, size_hint_y=None, size=[800, 800])
def update(self, dt):
pass
class ImageCheckApp(App):
def build(self):
game = Main()
game.setup()
Clock.schedule_interval(game.update, 1/60)
return game
if __name__ == "__main__":
app = ImageCheckApp()
app.run()
#: kivy 1.9.1
<Main>:
foreground: fg
background: bg
IMG:
id: fg
source: "background.png"
IMG:
id: bg
source: "foreground.png"
<IMG@Image>:
allow_stretch: True
keep_ratio: True
size_hint_x: None
size_hint_y: None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment