title: Curses window.getstr()
body: <p>I'm trying to learn curses for Python on Windows XP. I can get the window.getkey command to work correctly but the command window.getstr not only fails but the program exits. Here are sample code lines:</p>
  
  <pre><code>x = window.getkey()  # this works
  y = window.getstr()  # this fails
  </code></pre>
  
  <p>Obviously, to get the first line to work I have correctly imported curses and have done the <code>stdscr = curses.initscr()</code> command. My window is defined and working. I've tried placing the window coordinates within the getstr parens and I've used window.move. Neither works.  </p>
  
  <p>Any ideas why getstr doesn't work?</p>
  
  <p>Here's more info following the first suggestion:</p>
  
  <p>First, the suggestion to run the program in a command prompt window instead of from the desktop is a good one because the window was indeed disappearing.</p>
  
  <p>Here's the entirety of the program:</p>
  
  <pre><code># program = testcurses
  import curses
  stdscr = curses.initscr()
  
  window = stdscr.subwin(23,79,0,0)
  window.box()
  window.refresh()
  window.addstr(2,10, "This is my line of text")
  window.addstr(4,20,"What happened? ")
  window.refresh()
  
  mykey = window.getkey(5,20)
  mystr = window.getstr (6,20)
  #window.addstr (7,1, "Key data should be here: ")
  #window.addstr (7,33, mykey)
  window.addstr (8,1, "Str data should be here: ")
  window.addstr (8,33,mystr)
  window.refresh()
  </code></pre>
  
  <p>I remarked the lines pertaining to the display of the key data since that works OK.</p>
  
  <p>Here's the relevant part of the Traceback message:</p>
  
  <p>window.addstr (8,33,mystr)
  TypeError: must be str, not bytes.</p>
  
  <p>Tom</p>