1
我已經作出了計劃使用Python和pygame的,並使用py2app捆綁成一個.app文件。它只是當我點擊圖標時不能正常打開,它不會出現在屏幕上,直到我點擊了碼頭上的圖標,然後一些代碼已經運行,並且它破壞了實際程序的重點。爲什麼我的Python/pygame的應用程序不會彈出正確
我也似乎無法改變從正常的圖標,我所做的圖標上,我已經把它放入該文件夾,替換默認的一個。該圖標沒有出現在碼頭上,pygame蛇。
最後可以在任何MAC .app文件的工作?
BTW,這只是一個程序的一些有趣的 代碼:
import random, pygame, time, sys
time.sleep(2)
colour_1 = (0,255,255)
colour_2 = (0,255,0)
colour_3 = (255,255,0)
colour_4 = (255,0,0)
colour_5 = (0,0,255)
black = (0,0,0)
white = (255,255,255)
h = 500
w = 500
pygame.init()
FPS = 30
fpsClock = pygame.time.Clock()
screen = pygame.display.set_mode((w,h))
pygame.display.set_caption("You just lost the game")
alpha = 255
shape = screen.convert_alpha()
stimulus = pygame.Rect(0,0,500,500)
def the_game():
#Makes the text "the game" and the text "you just lost it" fade into the screen
global alpha
alpha = alpha - 5
##############
Font = pygame.font.SysFont("monospace",40,True,False)
Text = Font.render("The Game",1,white)
screen.blit(Text,(140,125))
pygame.draw.rect(shape,(0,0,0,alpha),stimulus)
screen.blit(shape,(0,0))
pygame.display.update(stimulus)
fpsClock.tick(FPS)
def lost_it():
#Writes "the game" and "you just lost it" onto the screen
Font = pygame.font.SysFont("monospace",40,True,False)
Text = Font.render("The Game",1,(white))
text = Font.render("YOU JUST LOST IT",1,(white))
screen.blit(text,(50,250))
screen.blit(Text,(140,125))
pygame.display.update()
def flash():
#Writes "the game" and "you just lost it" onto the screen
#Changes the background colour of the screen
Font = pygame.font.SysFont("monospace",40,True,False)
Text = Font.render("The Game",1,(black))
text = Font.render("YOU JUST LOST IT",1,(black))
rand = random.randint(0,5)
if rand == 1:
screen.fill(colour_1)
if rand == 2:
screen.fill(colour_2)
if rand == 3:
screen.fill(colour_3)
if rand == 4:
screen.fill(colour_4)
if rand == 5:
screen.fill(colour_5)
screen.blit(text,(50,250))
screen.blit(Text,(140,125))
pygame.display.update()
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit(); sys.exit();
while True:
if alpha == 0:
break
else:
the_game()
time.sleep(1)
lost_it()
while True:
flash()
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit(); sys.exit();
你需要表現出一定的最少的代碼,我們可以看到運行後的你在做什麼有得到一個回答這個問題的機會。我很喜歡你舔圖標的想法,但它顯示出來 - 滿分:D – GreenAsJade