SNHU-IT-140/Adventure Game/adventure_game/main.py

40 lines
1.2 KiB
Python

from blessed import Terminal
class Graphics:
def __init__(self):
self.bottom_left_corner = u""
self.bottom_right_corner = u""
self.top_left_corner = u""
self.top_right_corner = u""
self.border_horizontal = u""
self.border_vertical = u""
class Window:
def __init__(self, term, height, width, xpos, ypos, title=None):
self.term = term
self.title = title
self.height = height
self.width = width
self.xpos = xpos
self.ypos = ypos
def draw_borders(self):
# Print the top
print(
self.term.move_xy(self.xpos, self.ypos) +
u"" +
u"" * (self.width - 2) +
u""
)
# Print the middle
# We exclude the top and bottom rows since we'll draw them with other chars
for dx in range (1, self.height - 1):
print(self.term.move_xy(self.xpos + dx, self.ypos) + u'')
print(self.term.move_xy(self.xpos + dx, self.ypos + self.width - 1) + u'')
terminal = Terminal()
my_window = Window(terminal, 4, 20, 10, 10)
my_window.draw_borders()