summaryrefslogtreecommitdiffstats
path: root/Lib/stdwin/listwin.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-09-09 03:39:21 (GMT)
committerGuido van Rossum <guido@python.org>1997-09-09 03:39:21 (GMT)
commitd7500fcbb4d0257f3bcd0c87d17ee61f3b1545e8 (patch)
treedb4a6e4835e04851df721eb4595d7172d8e05c34 /Lib/stdwin/listwin.py
parent045e688f6fc06c87cc93f84e42fb4767a04ba559 (diff)
downloadcpython-d7500fcbb4d0257f3bcd0c87d17ee61f3b1545e8.zip
cpython-d7500fcbb4d0257f3bcd0c87d17ee61f3b1545e8.tar.gz
cpython-d7500fcbb4d0257f3bcd0c87d17ee61f3b1545e8.tar.bz2
These directories renamed: tkinter -> lib-tk, stdwin -> lib-stdwin.
Diffstat (limited to 'Lib/stdwin/listwin.py')
-rwxr-xr-xLib/stdwin/listwin.py47
1 files changed, 0 insertions, 47 deletions
diff --git a/Lib/stdwin/listwin.py b/Lib/stdwin/listwin.py
deleted file mode 100755
index 9480a81..0000000
--- a/Lib/stdwin/listwin.py
+++ /dev/null
@@ -1,47 +0,0 @@
-# Module 'listwin'
-# List windows, a subclass of gwin
-
-import gwin
-import stdwin
-
-def maxlinewidth(a): # Compute maximum textwidth of lines in a sequence
- max = 0
- for line in a:
- width = stdwin.textwidth(line)
- if width > max: max = width
- return max
-
-def action(w, string, i, detail): # Default item selection method
- pass
-
-def mup(w, detail): # Mouse up method
- (h, v), clicks, button, mask = detail
- i = divmod(v, w.lineheight)[0]
- if 0 <= i < len(w.data):
- w.action(w, w.data[i], i, detail)
-
-def draw(w, ((left, top), (right, bottom))): # Text window draw method
- data = w.data
- d = w.begindrawing()
- lh = w.lineheight
- itop = top/lh
- ibot = (bottom-1)/lh + 1
- if itop < 0: itop = 0
- if ibot > len(data): ibot = len(data)
- for i in range(itop, ibot): d.text((0, i*lh), data[i])
-
-def open(title, data): # Display a list of texts in a window
- lineheight = stdwin.lineheight()
- h, v = maxlinewidth(data), len(data)*lineheight
- h0, v0 = h + stdwin.textwidth(' '), v + lineheight
- if h0 > stdwin.textwidth(' ')*80: h0 = 0
- if v0 > stdwin.lineheight()*24: v0 = 0
- stdwin.setdefwinsize(h0, v0)
- w = gwin.open(title)
- w.setdocsize(h, v)
- w.lineheight = lineheight
- w.data = data
- w.draw = draw
- w.action = action
- w.mup = mup
- return w