SourceForge.net Logo

gtkforms

gtkforms is a python module used for creating gtk dialog in order to let the end user to manipulate python objects

Example:
from gtkform import *
class p:
    def __init__(self):
        self.pippo = "ciao"
        self.pluto = 3
        self.paperino = True

if (__name__=='__main__'):

    #create gtk.Dialog from python object

    a = p()
    print ("before...")
    print ("pippo=\t\t" + str(a.pippo))    
    print ("pluto=\t\t" + str(a.pluto))    
    print ("paperino=\t"+ str(a.paperino))
    create_gtk_dialog_from_object(a).run()
    print ("...after")
    print ("pippo=\t\t" + str(a.pippo))    
    print ("pluto=\t\t" + str(a.pluto))    
    print ("paperino=\t"+ str(a.paperino))


    #create gtk.Dialog from python dictionary

    d = {'pippo':'ciao', 'pluto':True, 'paperino':3}
    print ("before...")
    print (d)
    create_gtk_dialog_from_dict(d).run()
    print ("...after")
    print (d)


    #create gtk.Dialog from gtkforms.options

    opts = options()\
                .add('pippo', label="Pippo value", value= True)\
                .add('pluto', label="Pluto description", value= "ciao")\
                .add('paperino', label="Papetino flag", value= 3, style="integer(lower=0)")
    print ("before...")
    print ("pippo=\t\t" + str(opts.pippo))    
    print ("pluto=\t\t" + str(opts.pluto))    
    print ("paperino=\t"+ str(opts.paperino))
    create_gtk_dialog(opts).run()
    print ("...after")
    print ("pippo=\t\t" + str(opts.pippo))    
    print ("pluto=\t\t" + str(opts.pluto))    
    print ("paperino=\t"+ str(opts.paperino))
        


 
The following dialos will be created.



GTK Dialog from python object


GTK Dialog from python dictionay


GTK Dialog from gtkforms.options


Download