mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
Initial revision
This commit is contained in:
parent
4a5ab81bc9
commit
715a653152
10 changed files with 983 additions and 0 deletions
45
Demo/sgi/flp/test_nocb.py
Executable file
45
Demo/sgi/flp/test_nocb.py
Executable file
|
|
@ -0,0 +1,45 @@
|
|||
#
|
||||
# Example 1 - Using fl in python without callbacks.
|
||||
#
|
||||
# The form is named 'main_form' and resides on file 'test_nocb.fd'.
|
||||
# It has three objects named button1, button2 and exitbutton.
|
||||
#
|
||||
import fl # The forms library
|
||||
import FL # Symbolic constants for the above
|
||||
import flp # The module to parse .fd files
|
||||
import sys
|
||||
|
||||
# The following struct is created to hold the instance variables
|
||||
# main_form, button1, button2 and exitbutton.
|
||||
|
||||
class struct(): pass
|
||||
container = struct()
|
||||
|
||||
#
|
||||
# We now first parse the forms file
|
||||
|
||||
parsetree = flp.parse_form('test_nocb', 'main_form')
|
||||
|
||||
#
|
||||
# Next we create it
|
||||
|
||||
flp.create_full_form(container, parsetree)
|
||||
|
||||
#
|
||||
# And display it
|
||||
|
||||
container.main_form.show_form(FL.PLACE_MOUSE, 1, '')
|
||||
|
||||
#
|
||||
# And interact until the exit button is pressed
|
||||
while 1:
|
||||
selected_obj = fl.do_forms()
|
||||
if selected_obj == container.button1:
|
||||
print 'Button 1 selected'
|
||||
elif selected_obj == container.button2:
|
||||
print 'Button 2 selected'
|
||||
elif selected_obj == container.exitbutton:
|
||||
print 'Ok, bye bye'
|
||||
sys.exit(0)
|
||||
else:
|
||||
print 'do_forms() returned unknown object ', selected_obj
|
||||
Loading…
Add table
Add a link
Reference in a new issue