diff options
author | Guido van Rossum <guido@python.org> | 1997-09-09 03:39:21 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-09-09 03:39:21 +0000 |
commit | d7500fcbb4d0257f3bcd0c87d17ee61f3b1545e8 (patch) | |
tree | db4a6e4835e04851df721eb4595d7172d8e05c34 /Lib/stdwin/StripChart.py | |
parent | 045e688f6fc06c87cc93f84e42fb4767a04ba559 (diff) | |
download | cpython-git-d7500fcbb4d0257f3bcd0c87d17ee61f3b1545e8.tar.gz |
These directories renamed: tkinter -> lib-tk, stdwin -> lib-stdwin.
Diffstat (limited to 'Lib/stdwin/StripChart.py')
-rwxr-xr-x | Lib/stdwin/StripChart.py | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/Lib/stdwin/StripChart.py b/Lib/stdwin/StripChart.py deleted file mode 100755 index afec007ae4..0000000000 --- a/Lib/stdwin/StripChart.py +++ /dev/null @@ -1,70 +0,0 @@ -# Module 'StripChart' - -import rect -from Buttons import LabelAppearance, NoReactivity - -# A StripChart doesn't really look like a label but it needs a base class. -# LabelAppearance allows it to be disabled and hilited. - -class StripChart(LabelAppearance, NoReactivity): - # - def define(self, parent, scale): - self.parent = parent - parent.addchild(self) - self.init_appearance() - self.init_reactivity() - self.ydata = [] - self.scale = scale - self.resetbounds() - return self - # - def destroy(self): - self.parent = 0 - # - def setbounds(self, bounds): - LabelAppearance.setbounds(self, bounds) - self.resetbounds() - # - def resetbounds(self): - (left, top), (right, bottom) = self.bounds - self.width = right-left - self.height = bottom-top - excess = len(self.ydata) - self.width - if excess > 0: - del self.ydata[:excess] - elif excess < 0: - while len(self.ydata) < self.width: - self.ydata.insert(0, 0) - # - def append(self, y): - self.ydata.append(y) - excess = len(self.ydata) - self.width - if excess > 0: - del self.ydata[:excess] - if self.bounds <> rect.empty: - self.parent.scroll(self.bounds, (-excess, 0)) - if self.bounds <> rect.empty: - (left, top), (right, bottom) = self.bounds - i = len(self.ydata) - area = (left+i-1, top), (left+i, bottom) - self.draw(self.parent.begindrawing(), area) - # - def draw(self, d, area): - area = rect.intersect([area, self.bounds]) - if area == rect.empty: - return - d.cliprect(area) - d.erase(self.bounds) - (a_left, a_top), (a_right, a_bottom) = area - (left, top), (right, bottom) = self.bounds - height = bottom - top - i1 = a_left - left - i2 = a_right - left - for i in range(max(0, i1), min(len(self.ydata), i2)): - split = bottom-self.ydata[i]*height/self.scale - d.paint((left+i, split), (left+i+1, bottom)) - if not self.enabled: - self.flipenable(d) - if self.hilited: - self.fliphilite(d) - d.noclip() |