- Got rid of newmodule.c
[python/dscho.git] / Demo / sgi / flp / test_nocb.py
blob6346da3ed9c51d3b91405ea65de6a631000ee602
2 # Example 1 - Using fl in python without callbacks.
4 # The form is named 'main_form' and resides on file 'test_nocb.fd'.
5 # It has three objects named button1, button2 and exitbutton.
7 import fl # The forms library
8 import FL # Symbolic constants for the above
9 import flp # The module to parse .fd files
10 import sys
12 # The following struct is created to hold the instance variables
13 # main_form, button1, button2 and exitbutton.
15 class struct: pass
16 container = struct()
19 # We now first parse the forms file
21 parsetree = flp.parse_form('test_nocb', 'main_form')
24 # Next we create it
26 flp.create_full_form(container, parsetree)
29 # And display it
31 container.main_form.show_form(FL.PLACE_MOUSE, 1, '')
34 # And interact until the exit button is pressed
35 while 1:
36 selected_obj = fl.do_forms()
37 if selected_obj == container.button1:
38 print 'Button 1 selected'
39 elif selected_obj == container.button2:
40 print 'Button 2 selected'
41 elif selected_obj == container.exitbutton:
42 print 'Ok, bye bye'
43 sys.exit(0)
44 else:
45 print 'do_forms() returned unknown object ', selected_obj