Dbus drawing board
Dbus drawing board, is a Dbus server for drawing on a board using Cairo and Pango.
Server: Drawing board server listens to the dbus bus for drawing instractions.
Client: While a drawing board server is runnig, clients can send drawing instracions over dbus and draw on the server board.
The drawing instractions include Transformations (scale, rotate, translate), Paths (line, arc, rectangle), Texts (using pango, currently can't export texts to svg), Turtle graphics (e.g. forward, right, left ...) and File support (export to svg and png) instractions.
Here is the example client program (Hebrew texts are utf-8 encoded) used to make the screenshot below.
October, 2006: Ver 0.3.0 is out. Added support for picture drawing and themed pointer.
October, 2006: Ver 0.2.0 is out. name change from 'DbusCairoPangoBoard' to 'Dbus drawing board'
October, 2006: Ver 0.1.0 is out.
- python binding to dbus
- python binding to gtk (include the cairo and pango bindings)
[ On debian based systems do: apt-get install python-dbus python-gtk2 ]
#!/usr/bin/python # -*- coding: utf-8 -*- """ Connect to a dbus cairo pango drawing board server and draw a tree """ import dbus_board import math # Get an interface to a dbus drawing board if one is running cb = dbus_board.get() # Clear board cb.clear() cb.scale(-40, 400,-40, 400) # Set line width and color cb.line_width(3) # Draw a tree function def tree (size): if size < 2: cb.line_color(0, 1, 0, 0.8) cb.forward (size) else: cb.line_color(1, 0, 0, 0.5) cb.forward (size) cb.left (math.pi / 4) tree (size / 2) cb.right (math.pi / 2) tree (size / 2) cb.left (math.pi / 4) cb.move_backward (size) # Go to tree base and point up cb.move_to(125, 360) cb.left(math.pi / 2) # Draw tree tree (2 ** 7) # Export to a png file cb.save_png("tree") # Export to a svg file cb.save_svg("tree")
Kobi Zamir kzamir_AT_walla.co.il