Python Forum
[PyGame] Window not updating
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGame] Window not updating
#3
In addition to what nilamo said i dont believe your color variables are changing at all as you expect it to be. If you throw a couple prints around color is always the same and never seems to change in any of the draw methods.
Output:
Progress: [███-----------------------------------------------] 7.3% Completecolor is (75, 75, 75) color is (75, 75, 75) color is (75, 75, 75) color is (75, 75, 75) Progress: [███-----------------------------------------------] 7.3% Completecolor is (75, 75, 75) color is (75, 75, 75) color is (75, 75, 75) color is (75, 75, 75) Progress: [███-----------------------------------------------] 7.4% Completecolor is (75, 75, 75) color is (75, 75, 75) color is (75, 75, 75) color is (75, 75, 75) Progress: [███-----------------------------------------------] 7.4% Completecolor is (75, 75, 75) color is (75, 75, 75) color is (75, 75, 75) color is (75, 75, 75) Progress: [███-----------------------------------------------] 7.4% Completecolor is (75, 75, 75) color is (75, 75, 75) color is (75, 75, 75) color is (75, 75, 75) Progress: [███-----------------------------------------------] 7.4% Completecolor is (75, 75, 75) color is (75, 75, 75) color is (75, 75, 75) color is (75, 75, 75) Progress: [███-----------------------------------------------] 7.4% Completecolor is (75, 75, 75) color is (75, 75, 75) color is (75, 75, 75) color is (75, 75, 75) Progress: [███-----------------------------------------------] 7.4% Completecolor is (75, 75, 75) color is (75, 75, 75) color is (75, 75, 75) color is (75, 75, 75) Progress: [███-----------------------------------------------] 7.4% Completecolor is (75, 75, 75) color is (75, 75, 75) color is (75, 75, 75) color is (75, 75, 75)
If they are rapidly suppose to be changing from red to black and back, then it doesnt look like the color is changing at all in the first place.

Which leads me to believe that there might be an issue with your condition, or even before further of that. Didn't look too far into your code.
Quote:
        for i in range(len(self.__o_nodes)):
            if self.__o_nodes[i].data >= 0: color = black
            else: color = red

Which in turn, leads me to show you this...
https://python-forum.io/Thread-Basic-Nev...n-sequence
as it makes it hard to read for everyone and may introduce bugs. As well as not very pythonic.
Recommended Tutorials:
Reply


Messages In This Thread
Window not updating - by mberge - Jun-19-2019, 09:00 PM
RE: Window not updating - by nilamo - Jun-19-2019, 09:39 PM
RE: Window not updating - by metulburr - Jun-19-2019, 11:33 PM
RE: Window not updating - by mberge - Jun-21-2019, 12:12 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020