import wx
import numpy
import time

from __init__ import FastLines

app = wx.App(False)

frame = wx.Frame(None, -1, size=(500, 500))
p = wx.Panel(frame, -1, size=(500, 500))

xs = numpy.linspace(0, 500, 1000000)
ys = 250 + numpy.sin(xs/20) * 200

xs.shape = xs.size, 1
ys.shape = ys.size, 1
pts1 = numpy.append(xs, ys, 1)
pts2 = numpy.append(xs, ys + 10, 1)
pts3 = numpy.append(xs, ys + 20, 1)

def OnPaint(evt):
    dc = wx.PaintDC(p)

    dc.SetBrush(wx.WHITE_BRUSH)
    dc.DrawRectangle(0, 0, 500, 500)
    dc.SetPen(wx.BLACK_PEN)

    t1 = time.time()
    FastLines(dc, pts1)
    t2 = time.time()
    dc.DrawLines(pts2)
    t3 = time.time()
    dc.DrawLines(pts3.tolist())
    t4 = time.time()

    print "FastLines", t2 - t1, "DrawLines numpy", t3 - t2, "DrawLines list", t4 - t3

p.Bind(wx.EVT_PAINT, OnPaint)

frame.Show()

app.MainLoop()