title: Python curses: addstr() from file prints blanks for the remainder of the line
body: <p>I'm writing a very simple farming game in Python using curses. At this point I have been successful in allowing the player (just a "@" character) to move around within a window. </p>
  
  <p>I have a few files with ascii-art that I print to the window as things to populate the world in which the player can move around. For example, I have a file, named "house", that contains:</p>
  
  <pre><code> _ . ^ . _
  /____.____\
  |         |
  | ## _ ## |
  |_""_H_""_|
  </code></pre>
  
  <p>I have a Thing class as follows:</p>
  
  <pre><code>class Thing(object):    
  
      def __init__(self, Xstart, Ystart, looksLike, list, window):
          self.Xstart = Xstart
      self.Ystart = Ystart
      self.X = Xstart
      self.Y = Ystart
  
      self.looksLike = looksLike
  
      self.boundries = []
      self.find_boundries()
  
      list.append(self)
  
      self.draw(window)
  
  
  def find_boundries(self):
  
      file = open(self.looksLike).readlines()
      for line in file:
          for char in line:
          if char == '\n':
              pass
          elif char == ' ':   # skip all whitespace
              self.X += 1
          else:
                  self.boundries.append([self.X, self.Y])
              self.X += 1
  
          self.Y += 1
          self.X = self.Xstart
  
      self.X = self.Xstart    # reset x &amp; y to starting coordinates
      self.Y = self.Ystart
  
  
  def draw(self, window):
  
      #file = open(self.looksLike).readlines()
  
      #for line in file:
      #    window.addstr(self.Y, self.X, line)
      #    self.Y += 1
  
  #self.Y = self.Ystart
  
      file = open(self.looksLike).read()
  
      for char in file:
          window.addch(self.Y, self.X, char)
      if char == '\n':
              self.Y += 1
      self.X = self.Xstart
      else:
      self.X += 1
  
  self.X = self.Xstart    
  self.Y = self.Ystart
  </code></pre>
  
  <p>Thus the constructor for my Thing class takes a filename as an argument (looksLike) and the draw method opens the file, reads it, and prints its contents to the window. I can, then, create a house object, pass my "house" file as an argument, and my ascii house will be printed to the window.</p>
  
  <p>The problem is that once the object is printed to the window, when I move the player to the right of the printed object the player disappears. Above, below, and to the left of the printed object, however, the player stays in view. For example,</p>
  
  <pre><code> _ . ^ . _
  /____.____\
  |         |
  | ## _ ## |
  |_""_H_""_|
                    @
  </code></pre>
  
  <p>In this position the "@" character is visible, but if I move one space up, it disappears. If I continue moving the player up, the "@" will reappear after it moves beyond the topmost character of the house.</p>
  
  <p>I assume this issue is due to the nature of both addstr() and addch() ( I have tried both) printing whitespace until the end of the window, but I have been unable to find any documentation on this. </p>
  
  <p>I have considered creating a new window for each object printed, but this seems like it would get quite cumbersome when more than a few objects are printed to the window. Also, I hope to define borders around the objects printed to the screen that are shapes other than just squares or rectangles. </p>
  
  <p>Is there anyway to print from a file to the window without the trailing whitespace and without creating a new window for each printed object?</p>