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

[pygame] <PYGAME> EXE runtime or segmentation error



Hey i really need some help. I tried converting this script with pygame2exe , cx_freeze and pyinstaller. I am always getting either a crash with no error , a runtime error , or a segmentation error.  Help really need . Thanks 

#!/usr/bin/env python

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()
                pass
            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()