Allow supplying and image to image button.
authorSimon Cross <hodgestar@gmail.com>
Sat, 10 Sep 2016 14:18:16 +0000 (16:18 +0200)
committerSimon Cross <hodgestar@gmail.com>
Sat, 10 Sep 2016 14:18:16 +0000 (16:18 +0200)
tabakrolletjie/widgets.py

index 8ca16e31510c061a261a5cc39200dd01798f30bf..72d726f1d21cfc7ed3d1a53235002a8689561ea5 100644 (file)
@@ -66,7 +66,9 @@ class ImageButton(Button):
 
     def __init__(self, *imgparts, **kwargs):
         transform = kwargs.pop("transform", NullTransform())
-        self._img = loader.load_image(*imgparts, transform=transform)
+        self._img = kwargs.pop("image", None)
+        if self._img is None:
+            self._img = loader.load_image(*imgparts, transform=transform)
         name = kwargs.get('name')
         pos = kwargs.get('pos')
         padding = kwargs.get('padding', 0)