Mercurial > pyntnclick
diff gamelib/widgets.py @ 79:d7c0a702a0b4
Factor label width setting method out into a custom class (BoomLabel).
author | Simon Cross <hodgestar+bzr@gmail.com> |
---|---|
date | Mon, 23 Aug 2010 23:09:29 +0200 |
parents | |
children | d2f84f22def0 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gamelib/widgets.py Mon Aug 23 23:09:29 2010 +0200 @@ -0,0 +1,18 @@ +# widgets.py +# Copyright Boomslang team, 2010 (see COPYING File) + +"""Custom Albow widgets""" + +import albow.controls + + +class BoomLabel(albow.controls.Label): + + def set_margin(self, margin): + """Add a set_margin method that recalculates the label size""" + old_margin = self.margin + w, h = self.size + d = margin - old_margin + self.margin = margin + self.size = (w + 2 * d, h + 2 * d) +