code: def fit_to_window(self):
          '''fit image to window'''
          state = self.state
          self.dragpos = wx.Point(0, 0)
          client_area = state.frame.GetClientSize()
          self.zoom = min(float(client_area.x) / self.img.GetWidth(),
                          float(client_area.y) / self.img.GetHeight())
          self.need_redraw = Truf fit_to_window(self):
          '''fit image to window'''
          state = self.state
          self.dragpos = wx.Point(0, 0)
          client_area = state.frame.GetClientSize()
          self.zoom = min(float(client_area.x) / self.img.GetWidth(),
                          float(client_area.y) / self.img.GetHeight())
          self.need_redraw = True
docs: fit image to window