Guys, below is a part of an Object description in an application I am trying to code. I am using Tkinter for GUI. The Tkwindow hangs as soon as the "print self.gs" instruction is executed. Can it be rectified?
Any help will be appreciated

    def while_time(self):

        pass

    def gameplay(self):

        self.gs=self.get_schedule()#Schedule the games

        print self.gs

        self.gen_window()

        for game in self.gs:

            if self.chosen_team==TEAMS[game[0]] or self.chosen_team==TEAMS[game[1]]:

                while(self.play_click==0):

                    self.while_time()

                winner=self.sim_match(game)

                self.post_match(game, winner)

                self.play_click=0

            else:

                winner=self.sim_match(game)

                self.post_match(game, winner)

An infinite loop as play_click is not changed within the while loop

            while(self.play_click==0):
                self.while_time()

When testing it is a good idea to limit while loops

            ctr = 0
            while self.play_click==0:
                self.while_time()
                ctr += 1
                if ctr > 99:
                    print "Counter limit exit from while loop"
                    self.play_click=99

The apllication is a football league simulator. I already got it right in a Textual form. But in GUI form, I want it automatically simulate other games and when the chosen team's match comes up, I want it to wait for the user's button click. Thats why I have an update_click function to set the variable self.play_click to 1 which must exit the infinite loop. Is there a better way of doing it?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.