Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/thirdparty/cairoplot-trunk/trunk/gtktests.py
blob: 572126054bff54b0a14a4622bb18ab6286e0005b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

import gtk
import cairoplot
from cairoplot.handlers.gtk import GTKHandler

class CairoPlotWindow(gtk.Window):
    """GtkWindow to display a plot."""

    def __init__(self):
        """Make a plot to test."""
        gtk.Window.__init__(self)
        self.connect("destroy", gtk.main_quit)

        # make plot handler
        handler = GTKHandler()

        # default data
        data = [ (-2,10), (0,0), (0,15), (1,5), (2,0), (3,-10), (3,5) ]
        plot = cairoplot.ScatterPlot(handler, data=data,
                width=500, height=500, background="white",
                border=20, axis=True, grid=True)
        
        handler.plot = plot
        self.add(handler)
        handler.show()


if __name__ == "__main__":
    window = CairoPlotWindow()
    window.show()
    gtk.main()