Commit before breaking everything
[matches/honours.git] / research / transmission_spectroscopy / simulator / pgu-0.18 / examples / gui12.py
1 import sys
2 sys.path.insert(0, '..')
3
4
5 import pygame
6 from pygame.locals import *
7 from pgu import gui
8
9
10 def open_file_browser(arg):
11     d = gui.FileDialog()
12     d.connect(gui.CHANGE, handle_file_browser_closed, d)
13     d.open()
14     
15
16 def handle_file_browser_closed(dlg):
17     if dlg.value: input_file.value = dlg.value
18
19
20
21 #gui.theme.load('../data/themes/default')
22 app = gui.Desktop()
23 app.connect(gui.QUIT,app.quit,None)
24
25 main = gui.Container(width=500, height=400) #, background=(220, 220, 220) )
26
27
28 main.add(gui.Label("File Dialog Example", cls="h1"), 20, 20)
29
30
31 td_style = {'padding_right': 10}
32 t = gui.Table()
33 t.tr()
34 t.td( gui.Label('File Name:') , style=td_style )
35 input_file = gui.Input()
36 t.td( input_file, style=td_style )
37 b = gui.Button("Browse...")
38 t.td( b, style=td_style )
39 b.connect(gui.CLICK, open_file_browser, None)
40
41
42 main.add(t, 20, 100)
43
44 app.run(main)
45 #import profile
46 #profile.run('app.run(main)')

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