Skip to content

Instantly share code, notes, and snippets.

@jmaicher
Last active December 20, 2015 06:48
Show Gist options
  • Save jmaicher/6088258 to your computer and use it in GitHub Desktop.
Save jmaicher/6088258 to your computer and use it in GitHub Desktop.
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.widget import Widget
from kivy.core.image import Image
from kivy.properties import ObjectProperty
Builder.load_string("""
<BackgroundTest>:
canvas:
Rectangle:
pos: self.pos
size: self.size
texture: self.texture
""")
class BackgroundTest(Widget):
texture = ObjectProperty(None, allownone=True)
def __init__(self, **kwargs):
super(BackgroundTest, self).__init__(**kwargs)
self.texture = Image('pattern.jpg').texture
self.texture.wrap = 'repeat'
self.texture.uvsize = (3, 3)
class BackgroundTestApp(App):
def build(self):
return BackgroundTest()
if __name__ == '__main__':
BackgroundTestApp().run()
@jmaicher
Copy link
Author

Initially, everything looks good:

Initially

But as soon as I resize the window, the background breaks:

After resizing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment