Python is a wonderful tool to learn

The tutorials at TuxRadar are really simple to follow and it is surprising how much can be done with python + gtk + webkit in just a few minutes.



# -*- coding: utf-8 -*- #/usr/bin/python from xml.dom import minidom import urllib import gtk rss="http://www.tuxradar.com/rss" connection=urllib.urlopen(rss) feed=minidom.parse(connection) connection.close() items=feed.getElementsByTagName('item') len(items) item=items[0] print item.childNodes[0].nodeName print item.childNodes[1].nodeName print item.childNodes[2].nodeName print item.childNodes[3].nodeName print item.childNodes[1].childNodes[0].data window=gtk.Window() window.show() window.set_title("RSS FEED") vbox=gtk.VBox() window.add(vbox) textview = gtk.TextView() vbox.pack_start(textview) vbox.show_all() buffer=textview.get_buffer() vbox.remove(textview) combo=gtk.combo_box_new_text() vbox.pack_start(combo, False) for item in items: combo.append_text(item.childNodes[1].childNodes[0].data) vbox.pack_start(textview) print combo.get_active() window.show() vbox.show_all() wait=raw_input()

0 comments:

Automated Intelligence

Automated Intelligence
Auftrag der unendlichen LOL katzen