Phil's pyGame Utilities Documentation

Overview

Scripts
tileedit | leveledit | tganew | levelfancy

Reference
algo | ani | engine | fonts | high | html | layout | text | timer | vid

Tutorials
1 | 2 | 3 | 4 | 5

GUI Ref.
theme | style | widget | surface | const

Containers
container | app | table | document | area

Forms
form | group

Widgets
basic | button | input | keysym | slider | select | misc

Other
menus | dialog

Tutorials
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10

Dialogs and Documents

Documents layout widgets like words and images in a HTML document. This example also demonstrates the ScrollBox container widget.
  13:class AboutDialog(gui.Dialog):
  14:    def __init__(self,**params):
  15:        title = gui.Label("About Cuzco's Paint")
  16:
  17:        width = 400
  18:        height = 200
  19:        doc = gui.Document(width=width)
  20:
  21:        space = title.style.font.size(" ")
  22:
  23:        doc.block(align=0)
  24:        for word in """Cuzco's Paint v1.0 by Phil Hassey""".split(" "):
  25:            doc.add(gui.Label(word))
  26:            doc.space(space)
  27:        doc.br(space[1])
  28:
  29:        doc.block(align=-1)
  30:        doc.add(gui.Image("cuzco.png"),align=1)
  31:        for word in """Cuzco's Paint is a revolutionary new paint program it has all the awesome features that you need to paint really great pictures.""".split(" "):
  32:            doc.add(gui.Label(word))
  33:            doc.space(space)
  34:        doc.br(space[1])
  35:
  36:        doc.block(align=-1)
  37:        for word in """Cuzco's Paint will drive you wild!  Cuzco's Paint was made as a demo of Phil's Pygame Gui.  We hope you enjoy it!""".split(" "):
  38:            doc.add(gui.Label(word))
  39:            doc.space(space)
  40:
  41:        for i in range(0,10):
  42:            doc.block(align=-1)
  43:            for word in """This text has been added so we can show off our ScrollArea widget.  It is a very nice widget built by Gal Koren!""".split(" "):
  44:                doc.add(gui.Label(word))
  45:                doc.space(space)
  46:            doc.br(space[1])
  47:
  48:        gui.Dialog.__init__(self,title,gui.ScrollArea(doc,width,height))
The button CLICK event is connected to the dialog.open method.
  60:    dialog = AboutDialog()
  61:
  62:    e = gui.Button("About")
  63:    e.connect(gui.CLICK,dialog.open,None)

all content (c) 2006 Phil Hassey - Phil's pyGame Utilities