[wxPython] wxPython Properties

why do I have
to call a method like:
   size = thing.GetSize()
when
   size = thing.size
Would do just as well, and not have any side effects? Personally I
always find it odd (and annoying) when I have to call a method to just
get a value from an object.

Because thing.size is just the name of the function, while thing.size() is the function call itself. Which is also why "Python is full of such things."

Myself, I don't see what the big deal is. It's just a pair of parenthesis; I think I can deal with that much extra typing, especially if the payoff is maintainable code, lack of namespace clashes, or extra functionality by being able to override the method...

···

--
David Priest -- WritersBlock Technical Communications
Workplace Documentation, Manuals, Process Improvement
250 542-5208 www.sfu.ca/~priest

I'm having trouble making a ProgressDialog go away.

Below is the code. essentially, Load_Movie reads in a bunch of files and
stores the data in a list, bringing up a ProgressDialog while it does
so. Run_Movie loops through that list to put a series of images on the
screen.

If I run Load_Movie by itself first, an then run run_Movie, all is well.

Here's the problem. As you can see, Run_Movie checks to see if there is
data available to run amovie. If so, it starts the loop and all is well.
If there is no data available, then it calls Load_Movie to load the
data, and then calls itself again to run the movie. Unfortunatly, the
Progress dialog does not dissapear after the data has been loaded. In
fact, the whole movie runs behind the dialog box, and then id
disappears. I call the Destroy() method before I run the Movie, so what
gives??

Thanks,

-Chris

******** Code: **************

def Load_Movie(self, event):
  import glob
  dlg = wxFileDialog(self, "Choose one of the LE
files",".","","*.???",wxOPEN)
  if dlg.ShowModal() == wxID_OK:
    filename = dlg.GetPath()
    base = string.join(string.split(filename,'.')[:-1],'.')
    extension = string.split(filename,'.')[-1]
    LE_files = glob.glob(base+'.'+('[0-9]'*len(extension)))
    LE_movie = []
    max = len(LE_files)
    prog_dlg = wxProgressDialog("Loading...",
                 "I'm reading the LE files",
                 max-10,
                 self,)
    for i in range(max):
      prog_dlg.Update(i)
      filename = LE_files[i]
      (LEs,beached)=hazmat.read_binLE(filename)
      LE_movie.append(map_stuff.convert_to_meters(LEs,mapset.bb_l))
    prog_dlg.Destroy()
    self.map_win.LE_movie = LE_movie
  dlg.Destroy()

def Run_Movie(self, event):
  import time
  if self.map_win.LE_movie:
    for LEs in self.map_win.LE_movie:
      self.map_win.LEs = LEs
      self.map_win.changed = 1
      self.map_win.OnPaint()
  else:
    self.Load_Movie(None)
      self.Run_Movie(None)

···

--
Christopher Barker,
Ph.D.
cbarker@jps.net --- --- ---
http://www.jps.net/cbarker -----@@ -----@@ -----@@
                                   ------@@@ ------@@@ ------@@@
Water Resources Engineering ------ @ ------ @ ------ @
Coastal and Fluvial Hydrodynamics ------- --------- --------
------------------------------------------------------------------------
------------------------------------------------------------------------