title: How to make text fit inside a python curses textbox?
body: <p>I've tried many things attempting to make the text stay inside its borders but I can't find a way. Below is what I've already tried.</p>
  
  <pre><code>#!/usr/bin/env python
  
  import curses
  import textwrap
  
  screen = curses.initscr()
  screen.immedok(True)
  
  try:
      screen.border(0)
  
      box1 = curses.newwin(20, 40, 6, 50)
      box1.immedok(True)
      text = "I want all of this text to stay inside its box. Why does it keep going outside its borders?"
      box1.box()
      box1.addstr(1, 0, textwrap.fill(text, 39))
  
      #box1.addstr("Hello World of Curses!")
  
      screen.getch()
  
  finally:
      curses.endwin()
  </code></pre>