preload.py 477 B

123456789101112131415161718192021
  1. # -*- coding: utf-8 -*-
  2. import pygame
  3. from pygame.locals import *
  4. from sys import exit
  5. import os
  6. import sys
  7. from beeprint import pp
  8. ICONS_PRELOAD={}
  9. def load_icons():
  10. basepath = os.path.dirname(os.path.realpath(__file__))
  11. files = os.listdir(basepath)
  12. for i in files:
  13. if os.path.isfile(basepath+"/"+i) and i.endswith(".png"):
  14. keyname = i.split(".")[0]
  15. ICONS_PRELOAD[keyname] = pygame.image.load(basepath+"/"+i).convert_alpha()