diff gamelib/misc.py @ 519:f84ad10a9625

Remove move tool. Add basic controls reference dialog
author Neil Muller <drnlmuller@gmail.com>
date Fri, 27 Nov 2009 13:55:07 +0000
parents 96dbf2c8506e
children d16ed2a8a33e
line wrap: on
line diff
--- a/gamelib/misc.py	Fri Nov 27 13:34:50 2009 +0000
+++ b/gamelib/misc.py	Fri Nov 27 13:55:07 2009 +0000
@@ -115,4 +115,26 @@
     dialog.open()
     return dialog
 
+# Utility layout functions
 
+def make_box(text):
+    style = {
+            'border' : 1
+            }
+    word = gui.Label(text, style=style)
+    return word
+
+def fix_widths(doc):
+    """Loop through all the widgets in the doc, and set the
+       width of the labels to max + 10"""
+    # We need to do this because of possible font issues
+    max_width = 0
+    for thing in doc.widgets:
+        if hasattr(thing, 'style'):
+            # A label
+            if thing.style.width > max_width:
+                max_width = thing.style.width
+    for thing in doc.widgets:
+        if hasattr(thing, 'style'):
+            thing.style.width = max_width + 10
+