Skip to content

Instantly share code, notes, and snippets.

@brousch
Created March 7, 2014 18:47
Show Gist options
  • Save brousch/9417358 to your computer and use it in GitHub Desktop.
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.
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