Mercurial > boomslang
comparison 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 |
comparison
equal
deleted
inserted
replaced
78:6bfebfbce42e | 79:d7c0a702a0b4 |
---|---|
1 # widgets.py | |
2 # Copyright Boomslang team, 2010 (see COPYING File) | |
3 | |
4 """Custom Albow widgets""" | |
5 | |
6 import albow.controls | |
7 | |
8 | |
9 class BoomLabel(albow.controls.Label): | |
10 | |
11 def set_margin(self, margin): | |
12 """Add a set_margin method that recalculates the label size""" | |
13 old_margin = self.margin | |
14 w, h = self.size | |
15 d = margin - old_margin | |
16 self.margin = margin | |
17 self.size = (w + 2 * d, h + 2 * d) | |
18 |