projects
/
tabakrolletjie.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Allow supplying and image to image button.
[tabakrolletjie.git]
/
tabakrolletjie
/
widgets.py
diff --git
a/tabakrolletjie/widgets.py
b/tabakrolletjie/widgets.py
index f34fa35fccc0427477107fae9677b4be91d1cea0..72d726f1d21cfc7ed3d1a53235002a8689561ea5 100644
(file)
--- a/
tabakrolletjie/widgets.py
+++ b/
tabakrolletjie/widgets.py
@@
-6,6
+6,7
@@
import pygame.locals as pgl
from .loader import loader
from .constants import FONTS
from .loader import loader
from .constants import FONTS
+from .transforms import NullTransform
class Button(object):
class Button(object):
@@
-64,7
+65,10
@@
class TextButton(Button):
class ImageButton(Button):
def __init__(self, *imgparts, **kwargs):
class ImageButton(Button):
def __init__(self, *imgparts, **kwargs):
- self._img = loader.load_image(*imgparts)
+ transform = kwargs.pop("transform", NullTransform())
+ 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)
name = kwargs.get('name')
pos = kwargs.get('pos')
padding = kwargs.get('padding', 0)