class WhiteboardWindow(Tk): """Provides a window to draw to. """ def __init__(self, width=100, height=100, scaling=4, defaultPeriod=0): Tk.__init__(self) self.whiteboard = Whiteboard(self, width, height, scaling) self.defaultPeriod = defaultPeriod def draw(self, point, period=None, colour=None): if period is None: period = self.defaultPeriod if colour is None: colour = "blue" time.sleep(period) self.whiteboard.draw(point, colour) def clear(self): self.whiteboard.clear()
def __init__(self, width=100, height=100, scaling=4, defaultPeriod=0): Tk.__init__(self) self.whiteboard = Whiteboard(self, width, height, scaling) self.defaultPeriod = defaultPeriod
#! /usr/bin/python from Whiteboard import * from Tkinter import * root = Tk() w = Whiteboard(root,100,100,4) for x in range(50,60): for y in range(50,60): w.draw(Point(x,y),"blue") for i in range(10,90): w.draw(Point(i,2*i),"blue") root.mainloop()