Load image and return an image object
(name)
| 53 | |
| 54 | |
| 55 | def load_img(name): |
| 56 | """Load image and return an image object""" |
| 57 | |
| 58 | fullname = name |
| 59 | try: |
| 60 | image = pygame.image.load(fullname) |
| 61 | if image.get_alpha() is None: |
| 62 | image = image.convert() |
| 63 | else: |
| 64 | image = image.convert_alpha() |
| 65 | except pygame.error as message: |
| 66 | print("Error: couldn't load image: ", fullname) |
| 67 | raise SystemExit(message) |
| 68 | return (image, image.get_rect()) |
| 69 | |
| 70 | |
| 71 | if not fluidsynth.init(SF2): |