-3

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()
Rabbid76
  • 202,892
  • 27
  • 131
  • 174
Tyguy47
  • 1
  • 1
  • All macs have python installed. Just make it a project folks can run themslves? (i.e. with a venv and a requirements.txt that they can use to pip install the necessary packages). – Mike 'Pomax' Kamermans Mar 16 '23 at 20:01
  • Why do you specifically want a disk image? Is an app bundle unacceptable? "I can't export it as a DMG file using py2app since it uses pygame" -- So py2app normally can export to DMG but can't with pygame? Hmmm, strange. – Starbuck5 Mar 16 '23 at 20:44
  • @Starbuck5 , it does export it however it doesn't launch the app, I did do some more digging and found out that it will work as long as I don't add a custom icon using pygame. Is there any way to add a custom icon with py2app? – Tyguy47 Mar 17 '23 at 00:10
  • @Tguy47 I haven't used py2app myself, but it seems like there is an "iconfile" option. See https://py2app.readthedocs.io/en/latest/options.html – Starbuck5 Mar 17 '23 at 07:55

1 Answers1

0

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!

Tyguy47
  • 1
  • 1