text
text.py
a component of openallure.py
Collection of functions for rendering text
Copyright (c) 2010 John Graves
MIT License: see LICENSE.txt
-
class text.OpenAllureText(margins)
Text rendered to screen in Open Allure
-
buildQuestionText(question)
Prepare text of question and answers for display and reading aloud:
questionText[0] is question
questionText[1] is question + answer 1
questionText[2] is question + answer 1 + answer 2
etc.
justQuestionText[0] is first (perhaps only) part of question
justQuestionText[1] is next part of question
etc.
choiceCount tells how may answers there are
-
paintText(screen, justQuestionText, onText, questionText, onAnswer, highlight, stated, choice, colorLevel, colorLevels)
Paint words of justQuestionText and questionText on screen with appropriate colors.
What is appropriate depends on
- whether the question is stated (everything has been read aloud)
- how far along (onText) in the justQuestionText the reading of the question is
- how far along (onAnswer) in the questionText the reading of the answers is
- whether a choice has been selected
- if touched by highlight, the dwellTime-based colorLevel (out of colorLevels)
-
preRender(questionText, screenWidth=640, rightMargin=20)
- Pre-render text to find regions where it will be placed within screen with screenWidth and right margin of rightMargin
-
writewrap(s, font, rect, color, text)
write wrapped text
Copied from PyGame Utilities