Sending progress value to progress bar in python
Question: In my game I have two modules, **island.py** which loads the islands into my
game and the second module is **gui.py** which handles the gui widgets before
game starting. My problem is how to send the progress values from the
island.py module to the progress bar created in **gui.py** module **EDIT: also
with an instance of the loading screen to access the progress bar in it and
change its value.**

**In the module island.py**

    
    
    def __iter__(self):
            total = float(len(self.ground_map))
            import game.gui
            for i in self.get_coordinates():
                yield i
                global count
                count+=1
                progress = (count/total) * 100 
                game.gui.Gui.set_progress(progress)
            global count
            count = 0
    

**In the module gui.py**

    
    
    def show_loading_screen(self):
        self._switch_current_widget('loadingscreen', center=True, show=True) # Creates the loading screen and its associated widgets, except the progress bar.
    
    @staticmethod
    def set_progress(progress):
        # Now I have the progress values, and it will be updated automatically... how can I pass it to the progress bar widget?
        # I need to create the progress bar widget here, but to do that I need to have the self instance to give me the current screen that I will create the progress bar for **AND HERE IS THE PROBLEM!!**
        def update_loading_screen(progress):
            """updates the widget."""
            **self,current**.findChild(name="progressBar")._set_progress(progress)
        update_loading_screen(progress)
    

How I can make this update_loading_screen function?


Answer: Expanding on rocksport's answer...this is how I did it

    
    
    class GUI:
        def __init__(self):
            GUI.self = self
    
    
        @staticmethod
        def set_progressbar():
            print "set progress bar"
            print GUI.self
    
    
    g = GUI()
    g.set_progressbar()
    

