[pygtk] Simple diagram viewer

Ian Kanto ian.kanto at gmail.com
Mon Dec 24 10:31:59 WST 2007


Hi all,

please, I'm very new to GTK and I would like to write a very simple diagram
viewer but I don't really get a few things. It should draw a diagram (just
lines), zoom-in zoom-out (mouse-wheel), and if it will be larger than the
window mouse-drag around as well.

This is what I have so far:
a custom DrawingArea class, inside a Viewport, inside a ScrolledWindow. I
took the DrawingArea from "Writing a Widget Using Cairo and PyGTK 2.8" [1]
and here starts the trouble.

- How to zoom? "set_size_request()" doesn't work because the stroke width
remains the same. Also if the diagram would be small I would like to have it
in the center of the window but my current structure doesn't seem to work. I
messed with "Alignment(0.5, 0.5, 0, 0)" -- so far no luck.

I hope the drag-move will be easier I plan to connect to "drag-end" and
adjust the Viewport accordingly but for now I got stuck with the zooming.

Thanks for any feedback in advance!

/Ian

[1]
http://www.pygtk.org/articles/cairo-pygtk-widgets/cairo-pygtk-widgets.htm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20071224/0b34bea6/at=
tachment.htm


More information about the pygtk mailing list