#!/usr/bin/env python import pyglet #import math #import time #import serial from colours import * class Plot: def __init__(self, title="Unknown", size=(640, 480)): self.title = title self.size = size self.font = 'Arkhip' self.window = pyglet.window.Window(self.size[0], self.size[1], resizable=True) self.window.set_caption(title) def draw(self): self.drawBackground() self.drawHeading() def drawBackground(self): pyglet.image.SolidColorImagePattern(WHITE).create_image(self.size[0], self.size[1]).blit(0, 0) def drawHeading(self): heading = pyglet.text.Label(self.title, color=BLACK, font_name=self.font, font_size=self.size[0]/50, x=self.size[0]/2, y=self.size[1], anchor_x='center', anchor_y='top') heading.draw() plots = [] plots.append(Plot("This is a test plot")) def update(foo): for plot in plots: plot.window.clear() plot.draw() pyglet.clock.schedule_interval(update, 0.01) pyglet.app.run()