Cookbook Example
How can I...?
Example 8: Simple pygame based presentation tool. Components used: Graphline, Button, Chooser, Image
#!/usr/bin/pythonSource: Examples/example8/slideshow.py
from Kamaelia.UI.Pygame.Button import Button
from Kamaelia.UI.Pygame.Image import Image
from Kamaelia.Util.Chooser import Chooser
from Kamaelia.Util.Graphline import Graphline
import os
path = "Slides"
extn = ".gif"
allfiles = os.listdir(path)
files = list()
for fname in allfiles:
if fname[-len(extn):]==extn:
files.append(os.path.join(path,fname))
files.sort()
Graphline(
CHOOSER = Chooser(items = files),
IMAGE = Image(size=(800,600), position=(8,48)),
NEXT = Button(caption="Next", msg="NEXT", position=(72,8)),
PREVIOUS = Button(caption="Previous", msg="PREV",position=(8,8)),
FIRST = Button(caption="First", msg="FIRST",position=(256,8)),
LAST = Button(caption="Last", msg="LAST",position=(320,8)),
linkages = {
("NEXT","outbox") : ("CHOOSER","inbox"),
("PREVIOUS","outbox") : ("CHOOSER","inbox"),
("FIRST","outbox") : ("CHOOSER","inbox"),
("LAST","outbox") : ("CHOOSER","inbox"),
("CHOOSER","outbox") : ("IMAGE","inbox"),
}
).run()
(C) 2006 Kamaelia Contributors, including the British Broadcasting Corporation, All Rights Reserved, This is an ongoing community based development site. As a result the contents of this page is the opinions of the contributors of the pages involved not the organisations involved. Specificially, this page may contain personal views which are not the views of the BBC.