Modal

class quest.modal.Modal(game)[source]

A modal window is a pop-up that pauses the game until it is resolved. It is called a Modal because it puts the game into a new mode. To write modal subclasses, override text_label_contents() to change what is displayed, option_label_contents() to change the options presented, and choose_option(value) to change what should happen when a value is chosen. When a modal is ready to be closed, it should call self.close() from choose_option.

Parameters

game – The game which the Modal is part of.

text_label_contents()[source]

Returns a list of strings to be presented as text labels.

option_label_contents()[source]

Returns a list of strings to be presented as option labels.

set_text_labels()[source]

Creates text labels.

set_option_labels()[source]

Creates option labels.

choose_option(value)[source]

When a button is clicked, it calls choose_option with its value.

class quest.modal.DialogueModal(game, dialogue)[source]

A modal window powered by a Dialogue object.

text_label_contents()[source]

Returns a list of strings to be presented as text labels.

option_label_contents()[source]

Returns a list of strings to be presented as option labels.

choose_option(value)[source]

When a button is clicked, it calls choose_option with its value.

class quest.modal.AlertModal(game, message, response='OK')[source]

A simple modal, just used to return a result.

text_label_contents()[source]

Returns a list of strings to be presented as text labels.

option_label_contents()[source]

Returns a list of strings to be presented as option labels.

choose_option(value)[source]

When a button is clicked, it calls choose_option with its value.