Mercurial > sypikslang
comparison gamelib/gui_base.py @ 143:821ecb98e888
some icons and toggle button
author | Rizmari Versfeld <rizziepit@gmail.com> |
---|---|
date | Fri, 11 May 2012 03:13:22 +0200 |
parents | 9a30162f2a9c |
children | 53277724645b |
comparison
equal
deleted
inserted
replaced
142:3e02a8ccd72b | 143:821ecb98e888 |
---|---|
193 def draw(self, surface): | 193 def draw(self, surface): |
194 self.surface.fill((0, 0, 0, 0)) | 194 self.surface.fill((0, 0, 0, 0)) |
195 super(TextButton, self).draw(self.surface) | 195 super(TextButton, self).draw(self.surface) |
196 self.surface.blit(self.text_surface, self.text_offset) | 196 self.surface.blit(self.text_surface, self.text_offset) |
197 surface.blit(self.surface, self.rect) | 197 surface.blit(self.surface, self.rect) |
198 | |
199 | |
200 class ToggleButton(Button): | |
201 | |
202 def __init__(self, rect, normal_drwble, down_drwble): | |
203 super(ToggleButton, self).__init__(rect, normal_drwble, down_drwble) | |
204 self.toggled = False | |
205 | |
206 def on_click(self): | |
207 self.toggled = not self.toggled | |
208 if self.toggled: | |
209 self.set_state('DOWN') | |
210 else: | |
211 self.set_state('NORMAL') | |
198 | 212 |
199 | 213 |
200 class TextLabel(Drawable): | 214 class TextLabel(Drawable): |
201 | 215 |
202 def __init__(self, rect, text, font, color): | 216 def __init__(self, rect, text, font, color): |