Commit before breaking everything
[matches/honours.git] / research / transmission_spectroscopy / simulator / pgu-0.18 / examples / gui15.py
1 """an example of fancy event handling, ProgressBars, etc"""
2
3 import pygame
4 from pygame.locals import *
5
6 # the following line is not needed if pgu is installed
7 import sys; sys.path.insert(0, "..")
8
9 from pgu import gui
10 from pgu import html
11
12 app = gui.Desktop()
13
14 c = gui.Container(width=440,height=420)
15
16 c.add(gui.Label("Click on Cuzco's Face!"),0,0)
17
18 img = gui.Image("cuzco.png")
19
20 def myfnc(_event,_widget,_code,a,b,c):
21     print(_event,_widget,_code,a,b,c)
22     pos = _event.pos
23     img.value.fill((255,0,0),(pos[0],pos[1],2,2))
24     img.repaint()
25     t.tr()
26     t.td(gui.Label(str(("point at ",pos))))
27     prog.value += 1
28     #box.resize()
29     #box.set_vertical_scroll()
30
31 img.connect(gui.CLICK,myfnc,1,2,3)
32
33 c.add(img,20,20)
34
35 t = gui.Table()
36 box = gui.ScrollArea(t,300,240)
37 c.add(box,10,120)
38
39
40             
41
42 prog = gui.ProgressBar(10,0,40,width=200)
43 c.add(prog,50,400)
44
45 app.connect(gui.QUIT,app.quit,None)
46 app.run(c)

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