7 WINDOW_SIZE
= (640, 480)
9 THEME_FILE
= 'theme_two.zip'
10 WIDGET_FILE
= 'widgets.xml'
14 the_display
= pygame_init()
24 return pygame
.display
.set_mode(WINDOW_SIZE
)
29 gui_system
= GUISystem(WIDGET_FILE
, THEME_FILE
)
34 params_a
= {'x': 100, 'y': 50, 'width': 150, 'height': 50, 'text': 'a label'}
35 widgets
['test_label'] = gui_system
.makeWidget('label', params_a
)
37 params_b
= {'x': 75, 'y': 150, 'width': 200, 'height': 50, 'text': 'Hide/Show Label'}
38 widgets
['button_toggle'] = gui_system
.makeWidget('button', params_b
)
40 params_c
= {'x': 100, 'y': 250, 'width': 200, 'height': 35, 'text': ''}
41 widgets
['textbox_test'] = gui_system
.makeWidget('textbox', params_c
)
43 widgets
['button_toggle'].connect('BUTTON_CLICKED', button_clicked
)
47 def button_clicked(params
, more_params
):
50 if widgets
['test_label'].params
['parameters']['visible']:
51 widgets
['test_label'].hide()
53 widgets
['test_label'].show()
59 my_image
= pygame
.image
.load('turkey.jpg').convert()
69 the_event
= pygame
.event
.poll()
70 if the_event
.type == pygame
.QUIT
:
72 if the_event
.type == pygame
.NOEVENT
:
75 gui_system
.event(the_event
)
79 the_display
.blit(my_image
, (0, 0))
80 gui_system
.draw(the_display
)
85 if __name__
== '__main__':