python 3.x - Images disappear when resizing window in Kivy -
i've been following tutorial in kivy , encounter problem. when i'm changing size of window images doesn't display. code is:
from kivy.core.window import window kivy.uix.widget import widget kivy.uix.image import image kivy.app import app class sprite(image): def __init__(self, **kwargs): super().__init__(**kwargs) self.size = self.texture_size class game(widget): def __init__(self): super().__init__() self.background = sprite(source="sprites/cartoonforest.png") self.size = self.background.size self.add_widget(self.background) class gameapp(app): def build(self): game = game() window.size = game.size return game if __name__ == '__main__': gameapp().run()
i played around bit, imported different images of different extensions , sizes, changed in code , such, when left out line window.size = game.size
in build method in gameapp displayed image. when resized window dragging corner of image disappeared well.
what reason , how fix screen size match image size?
i'm using:
- mac os x yosemite 10.10.5
- pycharm community edition 2016.1.4
- python 3.5.2
- kivy v1.9.1
Comments
Post a Comment