How do I turn a python script that is using pygame into a DMG file?

165 Views Asked by At

So I have coded an app that I think would be really useful for Mac user but I have one problem! I can't export it as a DMG file using py2app since it uses pygame. I don't know if there's any other way to export it or any workaround. Please let me know is anyone knows how to so this and thanks in advance! :D (also if it makes a difference I am using a M1 MacBook Air base model)

Here's my code:

import pygame

img = pygame.image.load('icon.ico')
pygame.display.set_icon(img)

pygame.init()

size = (800, 600)
screen = pygame.display.set_mode(size)
pygame.display.set_caption("Desktop Clock")


done = False
while not done:
   
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            done = True

    
    screen.fill((255, 255, 255))

    
    pygame.display.flip()


pygame.quit()
1

There are 1 best solutions below

0
Tyguy47 On

For anyone wondering, it was the icon for pygame, if you are going to make the task bar icon something other than the default pygame one, you will need to use the .icns file type for you icon!