RAD with Python and Gnome

A presentation on the speed, flexibility and portability of Python & Gnome.

Pádraig Brady

Talk Outline

Python/Gnome Overview

Python Overview

GTK Overview

Example application

Python/Gnome Overview

libglade

Python

GTK

Low level

graphics

Data

(Distributables)

Logic

(Runtime)

Data source

(Development)

XML GUI

description

vi

glade

Python

Code

Python Overview

Clean

Cross platform

Interpreted

Strong/Dynamic/High level types

Object oriented

Easily extended and Embedded

Extensive default library

Opensource

More info in

Notes view

GTK Overview

Gimp Tool Kit

Used by GNOME

Takes ideas from TK

Python's default GUI tool kit is TK

Main idea is container model

Negates a lot of tedious logic

A LOT of functionality

ATK, I18n

Run gtk-demo for examples

Useful links
(presentation on www.pixelbeat.org)

Python (www.python.org)

Dive into Python (www.DiveIntoPython.org)

Thinking in Python (www.camtp.uni-mb.si/books/)

Tutorial index (www.awaretek.com/tutorials.html)

PyGTK (www.pygtk.org)

GTK (www.gtk.org)

clean

not an evolution from shell/awk like Perl

consistent use of type throughout language/libraries

interpreted

interactive

introspection

types

strong => each object has type (c/c++ have void* etc.)

dynamic => not done at compile time

def add(var1,var2):

print var1+var2

add(1,1)

add("1","1")

"1"+1

int("1")+1

high level

l=[1,"1",[add,dir]]

l[0:2]

l[-1][0](1)

" 1 2 3 4 ".strip()

" 1 2 3 4 ".strip().split()

for number in " 1 2 3 4 ".strip().split():

print number**2

d={1:"one",2:"two"}

d[3]="three"

d[3]=[1,2,3]

def library

see /usr/lib/python2.2

import os, re

rec=re.compile("^[g-k]")

filter(rec.match,os.listdir("/bin/"))

def filesizes(files):

file_size_map={}

for file in files:

file_size_map[file]=os.stat("/bin/"+file).st_size

return file_size_map

import locale

locale.setlocale(locale.LC_ALL,"")

def print_file_sizes(file_sizes):

for file in file_sizes:

print "%.7s\t%s" % (file,locale.format("%d", file_sizes[file], 1))

locale.setlocale(LC_ALL,"de_DE")

locale.setlocale(LC_ALL,"fr_FR")

LANG=el_GR gedit

LANG=ga_IE ./FSlint

import gtk

more later

extend/embed

openoffice = embed

modules = extend

Python Overview

2003-10-14T07:53:52