Last active
December 20, 2015 06:48
-
-
Save jmaicher/6088258 to your computer and use it in GitHub Desktop.
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
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Initially, everything looks good:
But as soon as I resize the window, the background breaks: