Exemplo n.º 1
0
def test():
	import sys, MMTree
	if sys.argv[1:]:
		filename = sys.argv[1]
	else:
		filename = 'demo.cmif'
	#
	print 'parsing', filename, '...'
	root = MMTree.ReadFile(filename)
	#
	print 'quit button ...'
	quitform = fl.make_form(FLAT_BOX, 50, 50)
	quitbutton = quitform.add_button(NORMAL_BUTTON, 0, 0, 50, 50, 'Quit')
	quitform.set_form_position(600, 10)
	quitform.show_form(PLACE_POSITION, FALSE, 'QUIT')
	#
	print 'showattreditor ...'
	showattreditor(root)
	#
	print 'go ...'
	while 1:
		obj = fl.do_forms()
		if obj = quitbutton:
			hideattreditor(root)
			break
		print 'This object should have a callback!', `obj.label`
Exemplo n.º 2
0
def main():
	qsize = 40
	opts, args = getopt.getopt(sys.argv[1:], 'q:')
	for o, a in opts:
		if o == '-q':
			qsize = string.atoi(a)
	ed = Editor(qsize)
	if args[0:]:
		ed.open_input(args[0])
	if args[1:]:
		ed.open_output(args[1])
	while 1:
		dummy = fl.do_forms()
Exemplo n.º 3
0
#! /usr/bin/env python
Exemplo n.º 4
0
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
Exemplo n.º 5
0
    #
    # The show function displays the form. It doesn't do any interaction,
    # though.
    def show(self):
        self.main_form.show_form(FL.PLACE_SIZE, 1, '')

    # The callback functions
    def button1CB(self, obj, arg):
        print 'Button 1 pressed on form', self.number

    def button2CB(self, obj, arg):
        print 'Button 2 pressed on form', self.number

    def exitbuttonCB(self, obj, arg):
        print 'Ok, bye bye'
        sys.exit(0)


#
# The main program. Instantiate two variables of the forms class
# and interact with them.

form1 = myform(1)
form2 = myform(2)

form1.show()
form2.show()

obj = fl.do_forms()
print 'do_forms() returned. This should not happen. obj=', obj
Exemplo n.º 6
0
Arquivo: Vb.py Projeto: carol8421/gosh
def main():
##	fl.set_graphics_mode(0, 1)
	vb = VideoBagOfTricks()
	while 1:
		dummy = fl.do_forms()
		[dummy]
Exemplo n.º 7
0
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
Exemplo n.º 8
0
#
# Example 2 - Using fl in python with callbacks.
#
# The form is named 'main_form' and resides on file 'test_cb.fd'.
# It has three objects named button1, button2 and exitbutton.
# All buttons have callbacks with the same names as their corresponding
# buttons but with CB appended.
#
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 myform:
    #
    # The constructor parses and creates the form, but doesn't
    # display it (yet).
    def __init__(self, number):
        #
        # First we parse the form
        parsetree = flp.parse_form('test_cb', 'main_form')
        #
        # Next we create it
        flp.create_full_form(self, parsetree)
        # And keep our number
        self.number = number
    #
    # The show function displays the form. It doesn't do any interaction,
Exemplo n.º 9
0
#
# 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:
Exemplo n.º 10
0
def main():
##	fl.set_graphics_mode(0, 1)
	vb = VideoBagOfTricks()
	while 1:
		dummy = fl.do_forms()
		[dummy]
Exemplo n.º 11
0
#
# Example 2 - Using fl in python with callbacks.
#
# The form is named 'main_form' and resides on file 'test_cb.fd'.
# It has three objects named button1, button2 and exitbutton.
# All buttons have callbacks with the same names as their corresponding
# buttons but with CB appended.
#
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 myform:
	#
	# The constructor parses and creates the form, but doesn't
	# display it (yet).
	def __init__(self, number):
		#
		# First we parse the form
		parsetree = flp.parse_form('test_cb', 'main_form')
		#
		# Next we create it
		
		flp.create_full_form(self, parsetree)
		# And keep our number
		self.number = number
	#
	# The show function displays the form. It doesn't do any interaction,
Exemplo n.º 12
0
	#
	# The show function displays the form. It doesn't do any interaction,
	# though.
	def show(self):
		self.main_form.show_form(FL.PLACE_SIZE, 1, '')

	# The callback functions
	def button1CB(self, obj, arg):
		print 'Button 1 pressed on form', self.number

	def button2CB(self, obj, arg):
		print 'Button 2 pressed on form', self.number

	def exitbuttonCB(self, obj, arg):
		print 'Ok, bye bye'
		sys.exit(0)

#
# The main program. Instantiate two variables of the forms class
# and interact with them.

form1 = myform(1)
form2 = myform(2)

form1.show()
form2.show()

obj = fl.do_forms()
print 'do_forms() returned. This should not happen. obj=', obj
Exemplo n.º 13
0
#! /usr/bin/env python
Exemplo n.º 14
0
#! /usr/bin/env python
Exemplo n.º 15
0
#! /usr/bin/env python