comparison gamelib/widgets.py @ 313:40dd77f71e11

Computer typeface for JIM.
author Jeremy Thurgood <firxen@gmail.com>
date Sat, 28 Aug 2010 09:37:21 +0200
parents 3cedc4f95925
children 3476e8f3b100
comparison
equal deleted inserted replaced
312:a0d66c0f5a89 313:40dd77f71e11
56 56
57 class MessageDialog(BoomLabel, CursorWidget): 57 class MessageDialog(BoomLabel, CursorWidget):
58 58
59 def __init__(self, screen, text, wrap_width, style=None, **kwds): 59 def __init__(self, screen, text, wrap_width, style=None, **kwds):
60 CursorWidget.__init__(self, screen) 60 CursorWidget.__init__(self, screen)
61 self.set_style(style)
61 paras = text.split("\n\n") 62 paras = text.split("\n\n")
62 text = "\n".join([textwrap.fill(para, wrap_width) for para in paras]) 63 text = "\n".join([textwrap.fill(para, wrap_width) for para in paras])
63 albow.controls.Label.__init__(self, text, **kwds) 64 albow.controls.Label.__init__(self, text, **kwds)
64 self.set_style(style)
65 65
66 def set_style(self, style): 66 def set_style(self, style):
67 self.set_margin(5) 67 self.set_margin(5)
68 self.border_width = 1 68 self.border_width = 1
69 self.border_color = (0, 0, 0) 69 self.border_color = (0, 0, 0)
70 self.bg_color = (127, 127, 127) 70 self.bg_color = (127, 127, 127)
71 self.fg_color = (0, 0, 0) 71 self.fg_color = (0, 0, 0)
72 if style == "JIM": 72 if style == "JIM":
73 self.set(font=get_font(20, "chintzy.ttf"))
73 self.bg_color = Color(255, 127, 127, 207) 74 self.bg_color = Color(255, 127, 127, 207)
74 self.fg_color = (0, 0, 0) 75 self.fg_color = (0, 0, 0)
75 self.border_color = (127, 0, 0) 76 self.border_color = (127, 0, 0)
76 77
77 def draw_all(self, surface): 78 def draw_all(self, surface):