comparison gamelib/misc.py @ 534:d16ed2a8a33e

Make price and control reference dialogs a little shinier.
author Simon Cross <hodgestar@gmail.com>
date Fri, 27 Nov 2009 22:12:20 +0000
parents f84ad10a9625
children 27c09c58d89d
comparison
equal deleted inserted replaced
533:7addf41b6abb 534:d16ed2a8a33e
2 2
3 import random 3 import random
4 4
5 from pygame.locals import KEYDOWN, K_ESCAPE 5 from pygame.locals import KEYDOWN, K_ESCAPE
6 from pgu import gui 6 from pgu import gui
7 from pgu import html
7 from pgu.algo import getline 8 from pgu.algo import getline
8 9
9 import serializer 10 import serializer
10 11
11 class Position(serializer.Simplifiable): 12 class Position(serializer.Simplifiable):
115 dialog.open() 116 dialog.open()
116 return dialog 117 return dialog
117 118
118 # Utility layout functions 119 # Utility layout functions
119 120
120 def make_box(text): 121 def make_box(text, markup=False):
121 style = { 122 style = {
122 'border' : 1 123 'border' : 1,
123 } 124 'padding_left': 2,
124 word = gui.Label(text, style=style) 125 'padding_right': 2,
126 'padding_top': 2,
127 'padding_bottom': 2,
128 }
129 if markup:
130 word = html.HTML(text, style=style)
131 else:
132 word = gui.Label(text, style=style)
125 return word 133 return word
126 134
127 def fix_widths(doc): 135 def fix_widths(doc):
128 """Loop through all the widgets in the doc, and set the 136 """Loop through all the widgets in the doc, and set the
129 width of the labels to max + 10""" 137 width of the labels to max + 10"""