Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > e184d86afc36a0f3c8dd76042f7aef59 > files > 81

python-Kiwi2-1.9.0-7mdv2010.0.noarch.rpm

#!/usr/bin/env python
from Kiwi2 import Views
from Kiwi2.initgtk import gtk, quit_if_last

# Empty model; GladeProxy will use it to hold the attributes
class NewsItem:
    """An instance representing an item of news. 
       Attributes: title, author, url, size"""
    pass

item = NewsItem()
my_widgets = ["title", "author", "url", "size"]
view = Views.BaseView(gladefile="newsform", widgets=my_widgets,
                      delete_handler=quit_if_last)
view.add_proxy(item, my_widgets)
view.focus_topmost()
view.show()
gtk.main() # runs till window is closed as per delete_handler

print 'Item: "%s" (%s) %s %d' % (item.title, item.author, item.url, item.size)