53 lines
2.3 KiB
Python
53 lines
2.3 KiB
Python
import npyscreen, sys
|
|
|
|
class ExitButton(npyscreen.ButtonPress):
|
|
def whenPressed(self):
|
|
sys.exit(0)
|
|
|
|
class GameNavigator(npyscreen.Form):
|
|
def afterEditing(self):
|
|
self.parentApp.setNextForm(None) # Nothing to do after this but exit the game.
|
|
|
|
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)
|
|
|
|
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.tryAction = self.add(ExitButton, name="Send", relx=inventory_width + art_width - 7, rely=top_division_height + 3) |