|
@@ -1,5 +1,5 @@
|
|
|
import tkinter as tk
|
|
|
-import time, math, noise
|
|
|
+import time, math
|
|
|
from PIL import Image, ImageDraw, ImageTk
|
|
|
|
|
|
class Graph(tk.Canvas):
|
|
@@ -15,7 +15,7 @@ class Graph(tk.Canvas):
|
|
|
self.image = self.create_image(0, 0, image=None, anchor='nw')
|
|
|
|
|
|
self.bind("<Configure>", self.on_resize)
|
|
|
- self.n = 0
|
|
|
+ self.scale = 450 / 2
|
|
|
|
|
|
def drawBackground(self):
|
|
|
self.bg = Image.new('RGB', (self.width, self.height), (0,20,0))
|
|
@@ -34,12 +34,10 @@ class Graph(tk.Canvas):
|
|
|
self.drawBackground()
|
|
|
self.canvas = Image.blend(self.canvas, self.bg, 0.1)
|
|
|
|
|
|
- def update(self):
|
|
|
+ def update(self, data):
|
|
|
self.coord = [self.coord[-1]]
|
|
|
- for i in range(30):
|
|
|
- self.coord.append(((noise.pnoise1(self.n)+1)*self.width/2, (noise.pnoise1(self.n*1.3+3)+1)*self.height/2))
|
|
|
-
|
|
|
- self.n += 0.001
|
|
|
+ for point in data[0]:
|
|
|
+ self.coord.append((point[0] / self.scale * self.width/2, point[1] / self.scale * self.height/2))
|
|
|
|
|
|
self.canvas = Image.blend(self.canvas, self.bg, 1/250)
|
|
|
draw = ImageDraw.Draw(self.canvas)
|