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

73 lines
2.9 KiB
Python

import npyscreen
import sys
class QuitButton(npyscreen.ButtonPress):
def whenPressed(self):
sys.exit(0)
class SendButton(npyscreen.ButtonPress):
def whenPressed(self):
self.parent.artContent.value = 'Undraw!'
#self.parent.parentApp.switchForm('GAME')
self.parent.artContent.display()
class GameNavigator(npyscreen.FormBaseNew):
# def afterEditing(self):
#it self.parentApp.setNextForm('GAME')
def render(self):
self.artContent.value = 'Undraw!'
def create(self):
top_division_height = 20
inventory_width = 20
art_width = 100
self.artBox = self.add(npyscreen.BoxBasic,
name='ArtBox',
max_width=art_width,
max_height=top_division_height,
rely=2,
relx=inventory_width + 1,
editable=False)
self.artContent = self.add(npyscreen.MultiLineEdit,
rely=3,
relx=inventory_width + 2,
max_width=art_width - 2,
max_height=top_division_height - 2,
value=self.parentApp.gamelib['menu']['graphics']['not_found'],
editable=False)
self.artBox.footer = 'Unknown Location'
self.artBox = self.add(npyscreen.BoxBasic,
name='Inventory',
max_width=inventory_width,
max_height=top_division_height,
relx=1,
rely=2,
editable=False)
self.dialogueBoxOutline = self.add(npyscreen.BoxBasic,
max_width=inventory_width + art_width,
max_height=3,
relx=1,
rely=top_division_height + 2,
editable=False)
self.dialogueBox = self.add(npyscreen.Textfield,
name='Type Here',
max_width=inventory_width + art_width - 7,
max_height=1,
relx=2,
rely=top_division_height + 3)
self.sendButton = self.add(SendButton,
name="Send",
relx=inventory_width + art_width - 7,
rely=top_division_height + 3)
self.quitButton = self.add(QuitButton,
name="Quit",
relx=1,
rely=1)