Merge branch 'master' of git.ucc.asn.au:/matches/honours
[matches/honours.git] / research / transmission_spectroscopy / simulator / pgu-0.18 / examples / html3.py
1 """<title>an example html forms and scripting</title>"""
2 import pygame
3 from pygame.locals import *
4
5 # the following line is not needed if pgu is installed
6 import sys; sys.path.insert(0, "..")
7
8 from pgu import gui
9 from pgu import html
10
11 app = gui.Desktop(width=780,height=800)
12
13 ##::
14 data = """
15
16
17 <img src='logo.gif' align='center'>
18 <center>
19 <h1>pgu forms and scripting demo</h1>
20 </center>
21 <hr>
22
23 <form id='form'>
24
25 <h2 align='center'>Name</h2>
26
27
28 </table>
29
30 <table align='center' style='border:1px; border-color: #000088; background: #ccccff; margin: 8px; padding: 8px;'>
31 <tr><td>
32
33
34
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'>
39 </table>
40
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>
47 </table>
48
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
63 </select>
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>
67 </table>
68
69 <center>
70 <input type='submit' value='Submit' onclick='print(form.results())'>
71 </center>
72
73 </form>
74
75 """
76 ##
77
78 doc = html.HTML(data,align=-1,valign=-1)
79
80 app.connect(gui.QUIT,app.quit,None)
81 app.run(doc)

UCC git Repository :: git.ucc.asn.au