[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] pygame2exe issue



This is my top - level script. When i turn it into a exe it run-time errors and hard crashes with no log as to why.  Any ideas 

import os
import sys
import pygame
from pygame.locals import *
from Loadimage import load_image
from Button import button
from Main import Main



resCount = 0
FullScreen = False
ResList = (800,600),(1680,1050),(1920,1080)
width , height = ResList[resCount]
pwidth , pheight = ResList[resCount]

pygame.init()
screen = pygame.display.set_mode((width,height))
pygame.display.set_caption("Menu")

pygame.mouse.set_visible(True)
background = "">
background = "">
background.fill((250,250,250))
if pygame.font:
  
    Title , textpos1 = button('Tech-Demo: Battle of Wit',48,background,50,(255,182,0))
    Start , textpos = button('Start Match',36,background,150,(172,88,88))
    Quit ,textpos2 = button('Quit',36,background,500,(172,88,88))
    Res , textrespos = button('Resolution',36,background,225,(172,88,88))
    Set , textsetpos = button('800 x 600',24,background,250,(5,5,138))
    Full , textfullpos = button('Fullscreen',36,background,300,(172,88,88))
    FSet , textDisabledpos = button('Disabled',24,background,325,(5,5,138))
    
    

screen.blit(background,(0,0))
pygame.display.flip()
while 1:
    kick = Main(pwidth,pheight)
    for event in pygame.event.get():
        if event.type == QUIT:
           pygame.quit()
           sys.exit()
           pygame.event.clear()
        if event.type == pygame.MOUSEBUTTONDOWN:
            x , y = pygame.mouse.get_pos()
            testmain = textpos.collidepoint(x,y)
            if(testmain == True):
                kick.start()
            testquit = textpos2.collidepoint(x,y)
            if(testquit == True):
                pygame.quit()
                sys.exit()
                
            testRes = textrespos.collidepoint(x,y)
            if(testRes == True):
              resCount += 1
              Set.fill((250,250,250))
              background.blit(Set,textsetpos)
              if resCount == len(ResList):
                resCount = 0
                pwidth , pheight = ResList[resCount]
              if(resCount == 0):
                Set , textsetpos = button('800 x 600',24,background,250,(5,5,138))
                pwidth , pheight = ResList[resCount]
              if(resCount == 1):
                Set , textsetpos = button('1650 x 1050',24,background,250,(5,5,138))
                pwidth , pheight = ResList[resCount]
              if(resCount == 2):
                Set , textsetpos = button('1920 x 1080',24,background,250,(5,5,138))
                pwidth , pheight = ResList[resCount]
              screen.blit(background,(0,0))
              pygame.display.flip()
            testFull = textfullpos.collidepoint(x,y)
            if(testFull == True):
                if(FullScreen == False):
                    FullScreen = True
                    FSet.fill((250,250,250))
                    background.blit(FSet,textDisabledpos)
                    FSet ,textDisabledpos = button('Enabled',24,background,325,(5,5,138))
                else:
                    FullScreen = False
                    FSet.fill((250,250,250))
                    background.blit(FSet,textDisabledpos)
                    FSet,textDisabledpos = button('Disabled',24,background,325,(5,5,138))
                screen.blit(background,(0,0))
                pygame.display.flip()


On Mon, Feb 4, 2013 at 1:24 AM, Brian Fisher <brian@xxxxxxxxxxxxxxxxxxx> wrote:
One of the core features of py2exe is that it automatically finds the
imported dependencies off of the main script, and includes them in the
package. Just specifying the top level script should be enough. The
problem you are describing should not be an issue.

Can you share Main.py? There may be something unusual about how it
imports the rest of the game.

Also, what exactly is the error you get?

On Sun, Feb 3, 2013 at 9:34 PM, Steven Sabatino
<sabatino.steven@xxxxxxxxx> wrote:
> I am using 2.7 and if you look at my script that stops the error you are
> talking about. This script works is a problem with the depend scripts not
> being loaded
>
> On Feb 3, 2013 11:35 PM, "Syndwar" <Possessed-by-zeal@xxxxxxxxx> wrote:
>>
>> The most common problem is lack of freesansbold.ttf in the compiled files.
>> For some reason py2exe and cxfreeze don't copy it to the library files.
>> Find
>> this file and copy it manualy to your compiled project. Also - what
>> version
>> of the python do you use?
>>
>>
>>
>> --
>> View this message in context:
>> http://pygame-users.25799.n6.nabble.com/pygame-pygame2exe-issue-tp472p473.html
>> Sent from the pygame-users mailing list archive at Nabble.com.