Cookbook Example

How can I...?

Example 8: Simple topology slideshow tool. Components used: pipeline, Button, Chooser, lines_to_tokenlists, TopologyViewerComponent

    #!/usr/bin/python

    from Kamaelia.UI.Pygame.Button import Button
    from Kamaelia.Util.Chooser import Chooser
    from Kamaelia.Visualisation.PhysicsGraph.lines_to_tokenlists import lines_to_tokenlists
    from Kamaelia.Visualisation.PhysicsGraph.TopologyViewerComponent import TopologyViewerComponent
    from Kamaelia.Util.PipelineComponent import pipeline

    graph = """\

    ADD NODE TCPClient TCPClient auto -
    ADD NODE VorbisDecode VorbisDecode auto -
    ADD NODE AOPlayer AOPlayer auto -
    ADD LINK TCPClient VorbisDecode
    ADD LINK VorbisDecode AOPlayer
    ADD NODE Multicast_Transceiver Multicast_Transceiver auto -
    ADD NODE detuple detuple auto -
    ADD LINK Multicast_Transceiver detuple
    DEL NODE TCPClient
    ADD LINK detuple VorbisDecode
    DEL ALL
    """.split("\n")

    pipeline(
    Button(caption="Next", msg="NEXT", position=(72,8)),
    Chooser(items = graph),
    lines_to_tokenlists(),
    TopologyViewerComponent(transparency = (255,255,255), showGrid = False),
    ).run()

    Source: Examples/example8/topology.py

 

Kamaelia is an open source project originated from and guided by BBC Research. For more information browse the site or get in contact.

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. (the site is powered by a wiki engine)

(C) Copyright 2008 Kamaelia Contributors, including the British Broadcasting Corporation, All Rights Reserved

This web site is powered by the same code created for the bicker manor project. For more details, contact Michael Sparks at BBC Research directly (cf contact)