Created
March 7, 2014 18:47
-
-
Save brousch/9417358 to your computer and use it in GitHub Desktop.
Kivy bug with original transparent image remaining in the background after it has been resized. There should be only a large red circle, the small one should be gone.
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.image import Image | |
kv = ''' | |
<FullImage>: | |
canvas: | |
Rectangle: | |
texture: self.texture | |
size: self.size | |
pos: self.pos | |
''' | |
Builder.load_string(kv) | |
class FullImage(Image): | |
def __init__(self, **kwargs): | |
super(FullImage, self).__init__(**kwargs) | |
self.source = "test.png" | |
class TestApp(App): | |
def build(self): | |
return FullImage() | |
if __name__ == '__main__': | |
#Create the background image | |
from PIL import Image, ImageDraw | |
img = Image.new('RGBA', (100, 100)) | |
draw = ImageDraw.Draw(img) | |
draw.ellipse((25, 25, 75, 75), outline=(255, 0, 0)) | |
img.save('test.png', 'PNG', transparency=0) | |
TestApp().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment