NET-BYU / sss

11 stars 1 forks source link

`draw_text()` producing unclear `IndexError` #36

Open doglman opened 1 year ago

doglman commented 1 year ago

While using the draw_text() function, I found I was regularly violating the preconditions of this function, which had not been communicated to me, producing the cryptic: IndexError: list assignment index out of range. I eventually figured out that my code was trying to draw strings that were too long and would exceed the rightmost boundaries of the screen.

Short term suggestions: The precondition (that text length and positioning must not exceed the width of the display) needs to be communicated in the function documentation.

Long term suggestions: Modify draw_text to be more resilient to strings that are "too long" by either: