-
Notifications
You must be signed in to change notification settings - Fork 0
/
window.py
80 lines (67 loc) · 1.94 KB
/
window.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import curses, sys
class screen:
scrn = None
row = None
col = None
class Window:
""" objects of Window class have: window, text[], string, nlines, ncols """
def __init__(self, string):
self.printedlines = 1
self.nlines = 25
self.ncols = 80
self.text = []
if string == "top":
self.makeTop()
elif string == "bottom":
self.makeBottom()
elif string == "border":
self.makeBorder()
elif string == "border2":
self.makeBorder2()
elif string == "menu":
self.makeMenu()
elif string == "menu2":
self.makeMenu2()
else:
print "weird"
def makeMenu(self):
self.window = curses.newwin(20, 20, 26, 1)
self.window.addstr("Enter 1 to bid:\n")
self.window.addstr("Enter 2 to exit:\n")
self.window.refresh()
return self
def makeMenu2(self):
self.window=curses.newwin(20, 20, 26, 1)
self.window.addstr("1: Make Announcement")
self.window.addstr("2: New Item\n")
self.window.addstr("3: End Item\n")
self.window.addstr("4: Close Auction\n")
self.window.refresh()
return self
def makeTop(self):
self.nlines=self.nlines-2
self.ncols=self.ncols-2
self.window = curses.newwin(self.nlines, self.ncols,1,1)
self.window.scrollok(True)
#self.window.refresh()
self.window.immedok(True)
return self
def makeBottom(self):
self.nlines=self.nlines-2
self.ncols=self.ncols-28
self.window = curses.newwin(self.nlines, self.ncols, 26, 23)
self.window.scrollok(True)
self.window.immedok(True)
return self
def makeBorder(self):
self.window = curses.newwin(self.nlines, self.ncols, 0, 0)
self.window.border()
self.window.refresh()
return self
def makeBorder2(self):
self.window = curses.newwin(self.nlines, self.ncols, 25, 0)
self.window.border()
self.window.refresh()
return self
def fileno(self):
return 1