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
12 # The following struct is created to hold the instance variables
13 # main_form, button1, button2 and exitbutton.
19 # We now first parse the forms file
21 parsetree
= flp
.parse_form('test_nocb', 'main_form')
26 flp
.create_full_form(container
, parsetree
)
31 container
.main_form
.show_form(FL
.PLACE_MOUSE
, 1, '')
34 # And interact until the exit button is pressed
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
:
45 print 'do_forms() returned unknown object ', selected_obj