1 """<title>an example html forms and scripting</title>"""
3 from pygame.locals import *
5 # the following line is not needed if pgu is installed
6 import sys; sys.path.insert(0, "..")
11 app = gui.Desktop(width=780,height=800)
17 <img src='logo.gif' align='center'>
19 <h1>pgu forms and scripting demo</h1>
25 <h2 align='center'>Name</h2>
30 <table align='center' style='border:1px; border-color: #000088; background: #ccccff; margin: 8px; padding: 8px;'>
35 <tr><td>First Name<td style='padding-left:8px'><input type='text' name='firstname' onchange='form["fullname"].value = "%s, %s"%(form["lastname"].value,form["firstname"].value)'>
36 <tr><td>Last Name<td style='padding-left:8px'><input type='text' name='lastname'
37 onchange='form["fullname"].value = "%s, %s"%(form["lastname"].value,form["firstname"].value)'>
38 <tr><td>Full Name<td style='padding-left:8px'><input type='text' name='fullname'>
41 <h2 align='center'>Address</h2>
42 <table align='center' style='border:1px; border-color: #000088; background: #ccccff; margin: 8px; padding: 8px;'>
43 <tr><td>Address 1<td style='padding-left:8px'><input type='text' name='address1'>
44 <tr><td>Address 2<td style='padding-left:8px'><input type='text' name='address2'>
45 <tr><td>City<td style='padding-left:8px'><input type='text' name='city'>
46 <tr><td>State<td style='padding-left:8px' align=left><input type='text' name='state' size=4> Zip: <input type='text' name='zip' size=10>
49 <h2 align='center'>Demographics</h2>
50 <table align='center' style='border:1px; border-color: #000088; background: #ccccff; margin: 8px; padding: 8px;'>
51 <tr><td>Age<td style='padding-left:8px' align=left><input type='text' name='age' size=5> Weight:
52 <input type='text' name='weight' size=5>
53 <tr><td>Sex<td style='padding-left:8px' align=left><input type='radio' name='sex' value='male'>Male <input type='radio' name='sex' value='female'>Female
54 <tr><td>Color<td style='padding-left:8px' align=left><select name='color' onchange='cview.value=self.value'>
55 <option value='#000000'>Black
56 <option value='#0000ff'>Blue
57 <option value='#00ff00'>Green
58 <option value='#00ffff'>Cyan
59 <option value='#ff0000'>Red
60 <option value='#ff00ff'>Purple
61 <option value='#ffff00'>Yellow
62 <option value='#ffffff'>White
64 <object type='gui.Color' width=80 height=20 border=1 id='cview'>
65 <tr><td>Pets<td style='padding-left:8px' align=left>
66 <table><tr><td align=left><input type='checkbox' name='pets' value='goat'> Goat <td align=left><input type='checkbox' name='pets' value='horse'> Horse <tr><td align=left><input type='checkbox' name='pets' value='hog'> Hog <td align=left><input type='checkbox' name='pets' value='cow'> Cow </table>
70 <input type='submit' value='Submit' onclick='print(form.results())'>
78 doc = html.HTML(data,align=-1,valign=-1)
80 app.connect(gui.QUIT,app.quit,None)