progress dialog update problem

ok i have a small program that coppies files from one place to another and i have a progress dialog that should update as the files are coppied

class MainWindow(wx.ProgressDialog):
def init(self, parent, id, title):

        maxcount = 0
        files = os.walk(starlight)
        for names in files:
            maxcount = maxcount + 1

------> wx.ProgressDialog._init
_(self, title, “test1”, maximum=maxcount, parent=None)
self.count = 0
shutil.copy2_old = shutil.copy2

        def copy2(src, dst):
            print "Copying %r->%r" % (src,dst)

            self.count = self.count + 1
            shutil.copy2_old(src,dst)
            print self.count

-----> ???.Update(self.count)
shutil.copy2 = copy2

my problem is what goes here to tell the program what to update, i know that if my progressDialog had a name (progresstest = wx.ProgressDialog()) i can reference that but how do i refrence something withought a name?

justin mcguire wrote:

ok i have a small program that coppies files from one place to another and i have a progress dialog that should update as the files are coppied

class MainWindow(wx.ProgressDialog):
        def __init__(self, parent, id, title):
            maxcount = 0
            files = os.walk(starlight)
            for names in files:
                maxcount = maxcount + 1
------> wx.ProgressDialog.__init_ _(self, title, "test1", maximum=maxcount, parent=None)
            self.count = 0
            shutil.copy2_old = shutil.copy2
                       def copy2(src, dst):
                print "Copying %r->%r" % (src,dst)
                self.count = self.count + 1
                shutil.copy2_old(src,dst)
                print self.count
-----> ???.Update(self.count)
            shutil.copy2 = copy2

my problem is what goes here to tell the program what to update, i know that if my progressDialog had a name (progresstest = wx.ProgressDialog()) i can reference that but how do i refrence something withought a name?

Since copy2 is a nested function (unless your indentation got screwed up in transit) then you have access to the names in the enclosing scope when the body of copy2 is running. So you can just use self.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!