Sep-22-2019, 10:54 PM
I learn to work with what is supplied.
Why take all that time to define colors ? When there is predefine colors.
If you don't like working with strings. You can always wrap it.
Why take all that time to define colors ? When there is predefine colors.
If you don't like working with strings. You can always wrap it.
import pygame class PygameColors: def __init__(self): self.__dict__.update(pygame.color.THECOLORS) def add(self, name, r, g, b, a=255): if name not in vars(self).keys(): setattr(self, name, pygame.Color(r, g, b, a)) else: print("Color already exists:", name) color = PygameColors() print("white:", color.white) print("black:", color.black) print("darkgray:", color.darkgray) print("darkgrey:", color.darkgrey) print("gray16:", color.gray16) print("green:", color.green) print("red:", color.red) print("yellow:", color.yellow) print("brown:", color.brown) print("darkgreen:", color.darkgreen) print("orange:", color.orange)
99 percent of computer problems exists between chair and keyboard.