Форум программистов, компьютерный форум, киберфорум
Python: GUI, графика
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 5.00/11: Рейтинг темы: голосов - 11, средняя оценка - 5.00
0 / 0 / 0
Регистрация: 02.09.2018
Сообщений: 12

Не открывается exe файл, сконвертированный Cx_freeze

22.07.2019, 12:24. Показов 2122. Ответов 3

Студворк — интернет-сервис помощи студентам
Написал игру используя pygame и переконвертировал в exe. При открытии exe выдаёт ошибку:
Прекращена работа программы
Сигнатура проблемы:
Имя события проблемы: APPCRASH
Имя приложения: GAME.exe
Версия приложения: 0.0.0.0
Отметка времени приложения: 549dea3c
Имя модуля с ошибкой: MSVCR100.dll
Версия модуля с ошибкой: 10.0.40219.325
Отметка времени модуля с ошибкой: 4df2be1e
Код исключения: 40000015
Смещение исключения: 0008d6fd
Версия ОС: 6.1.7601.2.1.0.768.3
Код языка: 1049
Дополнительные сведения 1: 03f9
Дополнительные сведения 2: 03f97f0a6bd2408168aa06a668613242
Дополнительные сведения 3: d9f3
Дополнительные сведения 4: d9f33fd3d887f44dc967cf625d8697fe


Код GAME.py:
Python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
from random import randrange
from random import choice
import os, pygame, sys
from pygame.locals import *
 
 
# Initialize screen
pygame.init()
 
def game():
        win = pygame.display.set_mode((500, 500))
        global fruitX, fruitY, fruit,fruits
        walkRight = pygame.image.load("data/Chuck_right.png")
        walkLeft = pygame.image.load("data/Chuck_left.png")
        bg = pygame.image.load("data/background.jpg")
        banana = pygame.image.load("data/banan.png")
        apple = pygame.image.load("data/apple.png")
        orange = pygame.image.load("data/orange.png")
        cherry = pygame.image.load("data/cherry.png")
        fruitSound = pygame.mixer.Sound(file='data/Fruit.wav')
        loseSound = pygame.mixer.Sound(file='data/Lose.wav')
        beginSound = pygame.mixer.Sound(file='data/begin.wav')
        newRecordSound = pygame.mixer.Sound(file='data/new-record.wav')
 
        fruits = [banana, apple, orange, cherry]
 
        aqua      = (  0, 255, 255)   # морская волна
        black     = (  0,   0,   0)   # черный       
        blue      = (  0,   0, 255)   # синий        
        fuchsia   = (255,   0, 255)   # фуксия       
        gray      = (128, 128, 128)   # серый        
        green     = (  0, 128,   0)   # зеленый      
        lime      = (  0, 255,   0)   # цвет лайма   
        maroon    = (128,   0,   0)   # темно-бордовый
        navy_blue = (  0,   0, 128)   # темно-синий  
        olive     = (128, 128,   0)   # оливковый    
        purple    = (128,   0, 128)   # фиолетовый   
        red       = (255,   0,   0)   # красный      
        silver    = (192, 192, 192)   # серебряный   
        teal      = (  0, 128, 128)   # зелено-голубой
        white     = (255, 255, 255)   # белый        
        yellow    = (255, 255,   0)   # желтый    
 
 
                        
                        
 
        font = pygame.font.Font(None, 25)
        gameOverFont = pygame.font.Font(None, 65)
 
        x = 60
        y = 425
        width = 60 
        height = 60
        speed = 4
        fruitX = 0
        fruitY = 0
        fruitWidth = 60
        fruitHeight = 60
        fruitCount = 0
        fileRecord = open('data/record.dat', 'r')
        record = int(fileRecord.read())
        fileRecord.close()
        def moveFruit():
                global fruitX, fruitY, fruit,fruits
                fruit = choice(fruits)
                pastFruitX = fruitX
                pastFruitY = fruitY
                fruitX = randrange(5,500 - fruitWidth - 5)
                fruitY = randrange(500 - fruitHeight - 120, 333)
                if pastFruitX > fruitX:
                        if pastFruitX - fruitX < 100:
                                moveFruit()
                else:
                        if fruitX - pastFruitX < 100:
                                moveFruit()
        isJump = False
        jumpCount = 10
        newRecordplay = False
        newRecord = False
        left = False
        right = False
        showFruit = True
        run = True
        time = 12
 
        win.blit(bg, (0,0))
        pygame.display.update()
        pygame.time.delay(1500)
        beginSound.play()
        gameOverText = gameOverFont.render("На старт!", True, red)
        win.blit(gameOverText, (140,180))
        pygame.display.update()
        pygame.time.delay(1500)
        gameOverText = gameOverFont.render("Внимание!", True, red)
        win.blit(gameOverText, (120,230))
        pygame.display.update()
        pygame.time.delay(1500)
        gameOverText = gameOverFont.render("Марш!", True, red)
        win.blit(gameOverText, (165,280))
        pygame.display.update()
        pygame.time.delay(1500)
        moveFruit()
 
        while  run:
                pygame.time.delay(20)
                time-=0.05
 
                recordText = font.render("Рекорд: {0}".format(record), True, black)
                text = font.render("Счет: {0}".format(fruitCount), True, black)
                timetext = font.render("Время: {0}".format(int(time)), True, black)
                for event in pygame.event.get():
                        if event.type == pygame.QUIT:
                                run = False
                keys = pygame.key.get_pressed()
                if keys[pygame.K_LEFT] and x > 5:
                        x-= speed
                        left = True
                        right = False
                if keys[pygame.K_RIGHT] and x < 500 - width - 5:
                        x+= speed
                        left = False
                        right = True        
                if not(isJump):
                        if keys[pygame.K_SPACE]:
                                isJump = True
                else:
                        if  jumpCount >= -10:
                                if jumpCount < 0:
                                        y += (jumpCount ** 2) / 2
                                else:
                                        y -= (jumpCount ** 2) / 2
                                jumpCount -= 1
                        else:
                                isJump = False
                                jumpCount = 10  
                win.blit(bg, (0,0))
                win.blit(text, (0,0))
                win.blit(timetext, (0,30))
                win.blit(recordText, (0,60))
                if showFruit:
                        win.blit(fruit, (fruitX, fruitY))
                if ((x - fruitX)<= 60 and (fruitX - x) <= 60) and ((y - fruitY)<= 60 and (fruitY - y) <= 60):
                        fruitSound.play()
                        fruitCount += 1
                        time += 2
                        moveFruit()
                if left:
                        win.blit(walkLeft, (x,y))
                elif right:
                        win.blit(walkRight, (x,y))
                else:
                        win.blit(walkRight, (x,y))
                if time <= 0:
                        break
                if fruitCount > record:
                        newRecord = True
                if newRecord == True and newRecordplay == False:
                        newRecordSound.play()
                        newRecordplay = True
                pygame.display.update()
        loseSound.play()    
        if newRecord:
         fileRecord = open('data/record.dat','w')
         fileRecord.write(str(fruitCount))
         fileRecord.close()
         gameOverFont = pygame.font.Font(None, 42)
         gameOverText = gameOverFont.render("Вы проиграли. Новый рекорд - {}".format(fruitCount), True, red)
         win.blit(gameOverText, (5, 200))
         pygame.display.update()    
        else: 
         gameOverText = gameOverFont.render("Вы проиграли", True, red)
         win.blit(gameOverText, (95, 200))
         pygame.display.update()    
        pygame.time.delay(4000)
        menu()
def menu():
        banana = pygame.image.load("data/banan.png")
        apple = pygame.image.load("data/apple.png")
        orange = pygame.image.load("data/orange.png")
        cherry = pygame.image.load("data/cherry.png")
        DISPLAYSURF = pygame.display.set_mode((800, 600))
        pygame.display.set_caption('Angry Birds Fruits 1.0')
 
        size = DISPLAYSURF.get_size()
        width = size[0]
        height = size[1]        
        title = pygame.Rect(((width/16)+1, (height/8)+1, 7*width/8, height/4))
        menu1 = pygame.Rect(((width/4)+1, (height/2)+1, 2*width/4, height/10))
        menu2 = pygame.Rect(((width/4)+1, (height/2)+1+(3*height/20), 2*width/4, height/10))
        menu3 = pygame.Rect(((width/4)+1, (height/2)+1+(6*height/20), 2*width/4, height/10))
 
        #Draws dark blue rectangles.
        pygame.draw.rect(DISPLAYSURF, (0,0,150), menu1)
        pygame.draw.rect(DISPLAYSURF, (0,0,150), menu2)
        pygame.draw.rect(DISPLAYSURF, (0,0,150), menu3)
 
        #Draws blue ovals on top of the rectangles.
        pygame.draw.ellipse(DISPLAYSURF, (0,0,150), title)
        pygame.draw.ellipse(DISPLAYSURF, (0,0,255), menu1)
        pygame.draw.ellipse(DISPLAYSURF, (0,0,255), menu2)
        pygame.draw.ellipse(DISPLAYSURF, (0,0,255), menu3)
 
        #pygame.font.Font takes in a font name and an integer for its size.
        #Free Sans Bold comes with Pygame (Sweigart 2012 p. 30).
        font_title = pygame.font.Font(None, 64)
        font_menu = pygame.font.Font(None, 32)
        font_mini = pygame.font.Font(None, 25)
        #Creates and draws the text.
        surface_title = font_title.render('Angry Birds Fruits', True, (0,255,0))
        rect_title = surface_title.get_rect() #get_rect() is my favorite Pygame function.
        rect_title.center = (width/2,(height/4)+3)
        surface_new_game = font_menu.render('ИГРАТЬ', True, (255,0,0))
        rect_new_game = surface_new_game.get_rect()
        rect_new_game.center = (width/2,(height/2)+(height/20)+3)
        surface_load_game = font_menu.render('СКОРО', True, (0,0,0))
        rect_load_game = surface_load_game.get_rect()
        rect_load_game.center = (width/2,(height/2)+(4*height/20)+3)
        surface_exit = font_menu.render('ВЫХОД', True, (0,0,0))
        rect_exit = surface_exit.get_rect()
        rect_exit.center = (width/2,(height/2)+(7*height/20)+3)
        bottom_text = font_mini.render('© АНАНЬЕВ НЕСТОРИАН. ANGRY BIRDS FRUITS 1.0', True, (255,255,255))
        Menu = True
        while Menu: #main game loop
            DISPLAYSURF.blit(surface_title, rect_title)
            DISPLAYSURF.blit(surface_new_game, rect_new_game)
            DISPLAYSURF.blit(surface_load_game, rect_load_game)
            DISPLAYSURF.blit(surface_exit, rect_exit)
            DISPLAYSURF.blit(apple, (15,250))
            DISPLAYSURF.blit(orange, (750,250))
            DISPLAYSURF.blit(cherry, (380,15))
            DISPLAYSURF.blit(banana, (380,250))
            DISPLAYSURF.blit(bottom_text, (190,570))
            for event in pygame.event.get():
                if event.type == MOUSEBUTTONUP:
                    if event.button == 1:
                        if (menu1.left < event.pos[0] < menu1.right) and (menu1.top < event.pos[1] < menu1.bottom):
                            Menu = False
                            game()
                        if (menu2.left < event.pos[0] < menu2.right) and (menu2.top < event.pos[1] < menu2.bottom):
                            pass
                        if (menu3.left < event.pos[0] < menu3.right) and (menu3.top < event.pos[1] < menu3.bottom):
                            pygame.event.post(pygame.event.Event(QUIT)) #Exits the game
 
                #When you mouse-over a button, the text turns green.
                if event.type == MOUSEMOTION:
                    if (menu1.left < event.pos[0] < menu1.right) and (menu1.top < event.pos[1] < menu1.bottom):
                        surface_new_game = font_menu.render('ИГРАТЬ', True, (0,255,0))
                    else:
                        surface_new_game = font_menu.render('ИГРАТЬ', True, (0,0,0))
                    if (menu2.left < event.pos[0] < menu2.right) and (menu2.top < event.pos[1] < menu2.bottom):
                        surface_load_game = font_menu.render('СКОРО', True, (255,255,0))
                    else:
                        surface_load_game = font_menu.render('СКОРО', True, (0,0,0))
                    if (menu3.left < event.pos[0] < menu3.right) and (menu3.top < event.pos[1] < menu3.bottom):
                        surface_exit = font_menu.render('ВЫХОД', True, (255,0,0))
                    else:
                        surface_exit = font_menu.render('ВЫХОД', True, (0,0,0))           
 
                if event.type == QUIT:
                    pygame.quit()
                    sys.exit()
            pygame.display.update()
menu()
Код setup.py:
Python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
from random import randrange
from random import choice
import os, pygame, sys
from pygame.locals import *
 
 
# Initialize screen
pygame.init()
 
def game():
        win = pygame.display.set_mode((500, 500))
        global fruitX, fruitY, fruit,fruits
        walkRight = pygame.image.load("data/Chuck_right.png")
        walkLeft = pygame.image.load("data/Chuck_left.png")
        bg = pygame.image.load("data/background.jpg")
        banana = pygame.image.load("data/banan.png")
        apple = pygame.image.load("data/apple.png")
        orange = pygame.image.load("data/orange.png")
        cherry = pygame.image.load("data/cherry.png")
        fruitSound = pygame.mixer.Sound(file='data/Fruit.wav')
        loseSound = pygame.mixer.Sound(file='data/Lose.wav')
        beginSound = pygame.mixer.Sound(file='data/begin.wav')
        newRecordSound = pygame.mixer.Sound(file='data/new-record.wav')
 
        fruits = [banana, apple, orange, cherry]
 
        aqua      = (  0, 255, 255)   # морская волна
        black     = (  0,   0,   0)   # черный       
        blue      = (  0,   0, 255)   # синий        
        fuchsia   = (255,   0, 255)   # фуксия       
        gray      = (128, 128, 128)   # серый        
        green     = (  0, 128,   0)   # зеленый      
        lime      = (  0, 255,   0)   # цвет лайма   
        maroon    = (128,   0,   0)   # темно-бордовый
        navy_blue = (  0,   0, 128)   # темно-синий  
        olive     = (128, 128,   0)   # оливковый    
        purple    = (128,   0, 128)   # фиолетовый   
        red       = (255,   0,   0)   # красный      
        silver    = (192, 192, 192)   # серебряный   
        teal      = (  0, 128, 128)   # зелено-голубой
        white     = (255, 255, 255)   # белый        
        yellow    = (255, 255,   0)   # желтый    
 
 
                        
                        
 
        font = pygame.font.Font(None, 25)
        gameOverFont = pygame.font.Font(None, 65)
 
        x = 60
        y = 425
        width = 60 
        height = 60
        speed = 4
        fruitX = 0
        fruitY = 0
        fruitWidth = 60
        fruitHeight = 60
        fruitCount = 0
        fileRecord = open('data/record.dat', 'r')
        record = int(fileRecord.read())
        fileRecord.close()
        def moveFruit():
                global fruitX, fruitY, fruit,fruits
                fruit = choice(fruits)
                pastFruitX = fruitX
                pastFruitY = fruitY
                fruitX = randrange(5,500 - fruitWidth - 5)
                fruitY = randrange(500 - fruitHeight - 120, 333)
                if pastFruitX > fruitX:
                        if pastFruitX - fruitX < 100:
                                moveFruit()
                else:
                        if fruitX - pastFruitX < 100:
                                moveFruit()
        isJump = False
        jumpCount = 10
        newRecordplay = False
        newRecord = False
        left = False
        right = False
        showFruit = True
        run = True
        time = 12
 
        win.blit(bg, (0,0))
        pygame.display.update()
        pygame.time.delay(1500)
        beginSound.play()
        gameOverText = gameOverFont.render("На старт!", True, red)
        win.blit(gameOverText, (140,180))
        pygame.display.update()
        pygame.time.delay(1500)
        gameOverText = gameOverFont.render("Внимание!", True, red)
        win.blit(gameOverText, (120,230))
        pygame.display.update()
        pygame.time.delay(1500)
        gameOverText = gameOverFont.render("Марш!", True, red)
        win.blit(gameOverText, (165,280))
        pygame.display.update()
        pygame.time.delay(1500)
        moveFruit()
 
        while  run:
                pygame.time.delay(20)
                time-=0.05
 
                recordText = font.render("Рекорд: {0}".format(record), True, black)
                text = font.render("Счет: {0}".format(fruitCount), True, black)
                timetext = font.render("Время: {0}".format(int(time)), True, black)
                for event in pygame.event.get():
                        if event.type == pygame.QUIT:
                                run = False
                keys = pygame.key.get_pressed()
                if keys[pygame.K_LEFT] and x > 5:
                        x-= speed
                        left = True
                        right = False
                if keys[pygame.K_RIGHT] and x < 500 - width - 5:
                        x+= speed
                        left = False
                        right = True        
                if not(isJump):
                        if keys[pygame.K_SPACE]:
                                isJump = True
                else:
                        if  jumpCount >= -10:
                                if jumpCount < 0:
                                        y += (jumpCount ** 2) / 2
                                else:
                                        y -= (jumpCount ** 2) / 2
                                jumpCount -= 1
                        else:
                                isJump = False
                                jumpCount = 10  
                win.blit(bg, (0,0))
                win.blit(text, (0,0))
                win.blit(timetext, (0,30))
                win.blit(recordText, (0,60))
                if showFruit:
                        win.blit(fruit, (fruitX, fruitY))
                if ((x - fruitX)<= 60 and (fruitX - x) <= 60) and ((y - fruitY)<= 60 and (fruitY - y) <= 60):
                        fruitSound.play()
                        fruitCount += 1
                        time += 2
                        moveFruit()
                if left:
                        win.blit(walkLeft, (x,y))
                elif right:
                        win.blit(walkRight, (x,y))
                else:
                        win.blit(walkRight, (x,y))
                if time <= 0:
                        break
                if fruitCount > record:
                        newRecord = True
                if newRecord == True and newRecordplay == False:
                        newRecordSound.play()
                        newRecordplay = True
                pygame.display.update()
        loseSound.play()    
        if newRecord:
         fileRecord = open('data/record.dat','w')
         fileRecord.write(str(fruitCount))
         fileRecord.close()
         gameOverFont = pygame.font.Font(None, 42)
         gameOverText = gameOverFont.render("Вы проиграли. Новый рекорд - {}".format(fruitCount), True, red)
         win.blit(gameOverText, (5, 200))
         pygame.display.update()    
        else: 
         gameOverText = gameOverFont.render("Вы проиграли", True, red)
         win.blit(gameOverText, (95, 200))
         pygame.display.update()    
        pygame.time.delay(4000)
        menu()
def menu():
        banana = pygame.image.load("data/banan.png")
        apple = pygame.image.load("data/apple.png")
        orange = pygame.image.load("data/orange.png")
        cherry = pygame.image.load("data/cherry.png")
        DISPLAYSURF = pygame.display.set_mode((800, 600))
        pygame.display.set_caption('Angry Birds Fruits 1.0')
 
        size = DISPLAYSURF.get_size()
        width = size[0]
        height = size[1]        
        title = pygame.Rect(((width/16)+1, (height/8)+1, 7*width/8, height/4))
        menu1 = pygame.Rect(((width/4)+1, (height/2)+1, 2*width/4, height/10))
        menu2 = pygame.Rect(((width/4)+1, (height/2)+1+(3*height/20), 2*width/4, height/10))
        menu3 = pygame.Rect(((width/4)+1, (height/2)+1+(6*height/20), 2*width/4, height/10))
 
        #Draws dark blue rectangles.
        pygame.draw.rect(DISPLAYSURF, (0,0,150), menu1)
        pygame.draw.rect(DISPLAYSURF, (0,0,150), menu2)
        pygame.draw.rect(DISPLAYSURF, (0,0,150), menu3)
 
        #Draws blue ovals on top of the rectangles.
        pygame.draw.ellipse(DISPLAYSURF, (0,0,150), title)
        pygame.draw.ellipse(DISPLAYSURF, (0,0,255), menu1)
        pygame.draw.ellipse(DISPLAYSURF, (0,0,255), menu2)
        pygame.draw.ellipse(DISPLAYSURF, (0,0,255), menu3)
 
        #pygame.font.Font takes in a font name and an integer for its size.
        #Free Sans Bold comes with Pygame (Sweigart 2012 p. 30).
        font_title = pygame.font.Font(None, 64)
        font_menu = pygame.font.Font(None, 32)
        font_mini = pygame.font.Font(None, 25)
        #Creates and draws the text.
        surface_title = font_title.render('Angry Birds Fruits', True, (0,255,0))
        rect_title = surface_title.get_rect() #get_rect() is my favorite Pygame function.
        rect_title.center = (width/2,(height/4)+3)
        surface_new_game = font_menu.render('ИГРАТЬ', True, (255,0,0))
        rect_new_game = surface_new_game.get_rect()
        rect_new_game.center = (width/2,(height/2)+(height/20)+3)
        surface_load_game = font_menu.render('СКОРО', True, (0,0,0))
        rect_load_game = surface_load_game.get_rect()
        rect_load_game.center = (width/2,(height/2)+(4*height/20)+3)
        surface_exit = font_menu.render('ВЫХОД', True, (0,0,0))
        rect_exit = surface_exit.get_rect()
        rect_exit.center = (width/2,(height/2)+(7*height/20)+3)
        bottom_text = font_mini.render('© АНАНЬЕВ НЕСТОРИАН. ANGRY BIRDS FRUITS 1.0', True, (255,255,255))
        Menu = True
        while Menu: #main game loop
            DISPLAYSURF.blit(surface_title, rect_title)
            DISPLAYSURF.blit(surface_new_game, rect_new_game)
            DISPLAYSURF.blit(surface_load_game, rect_load_game)
            DISPLAYSURF.blit(surface_exit, rect_exit)
            DISPLAYSURF.blit(apple, (15,250))
            DISPLAYSURF.blit(orange, (750,250))
            DISPLAYSURF.blit(cherry, (380,15))
            DISPLAYSURF.blit(banana, (380,250))
            DISPLAYSURF.blit(bottom_text, (190,570))
            for event in pygame.event.get():
                if event.type == MOUSEBUTTONUP:
                    if event.button == 1:
                        if (menu1.left < event.pos[0] < menu1.right) and (menu1.top < event.pos[1] < menu1.bottom):
                            Menu = False
                            game()
                        if (menu2.left < event.pos[0] < menu2.right) and (menu2.top < event.pos[1] < menu2.bottom):
                            pass
                        if (menu3.left < event.pos[0] < menu3.right) and (menu3.top < event.pos[1] < menu3.bottom):
                            pygame.event.post(pygame.event.Event(QUIT)) #Exits the game
 
                #When you mouse-over a button, the text turns green.
                if event.type == MOUSEMOTION:
                    if (menu1.left < event.pos[0] < menu1.right) and (menu1.top < event.pos[1] < menu1.bottom):
                        surface_new_game = font_menu.render('ИГРАТЬ', True, (0,255,0))
                    else:
                        surface_new_game = font_menu.render('ИГРАТЬ', True, (0,0,0))
                    if (menu2.left < event.pos[0] < menu2.right) and (menu2.top < event.pos[1] < menu2.bottom):
                        surface_load_game = font_menu.render('СКОРО', True, (255,255,0))
                    else:
                        surface_load_game = font_menu.render('СКОРО', True, (0,0,0))
                    if (menu3.left < event.pos[0] < menu3.right) and (menu3.top < event.pos[1] < menu3.bottom):
                        surface_exit = font_menu.render('ВЫХОД', True, (255,0,0))
                    else:
                        surface_exit = font_menu.render('ВЫХОД', True, (0,0,0))           
 
                if event.type == QUIT:
                    pygame.quit()
                    sys.exit()
            pygame.display.update()
menu()
Вложения
Тип файла: rar data.rar (1,022.4 Кб, 1 просмотров)
0
Лучшие ответы (1)
IT_Exp
Эксперт
34794 / 4073 / 2104
Регистрация: 17.06.2006
Сообщений: 32,602
Блог
22.07.2019, 12:24
Ответы с готовыми решениями:

Как исправить ошибку в сборке в .exe файл cx_Freeze?
Собираю проект пробывал через pyinstaller, и вот через cx_Freeze, суть ошибки что там что здесь одна и таже, здесь он ее явно выдает....

Как можно защитить BAT, сконвертированный в EXE?
Здравствуйте, необходимо сделать из BAT файла экзешник, который не будет поддаваться декомпиляции. Обычные BAT to EXE (во всяком случае,...

Вместо запуска EXE файлов открывается сайт браузер с предложением скачать файл с названием EXE
Логи отсутствуют, т.к. не могу запустить автологер. Вместо запуска EXE файлов открывается сайт imatiro ру в браузере с предложением...

3
1293 / 677 / 367
Регистрация: 07.01.2019
Сообщений: 2,301
22.07.2019, 18:15
Лучший ответ Сообщение было отмечено Nestor87 как решение

Решение

Попробуйте пути к файлам записать так

Python
1
walkRight = pygame.image.load(os.path.join("data/Chuck_right.png"))
еще попробуйте puinstaller
1
Модератор
Эксперт Python
 Аватар для Fudthhh
2695 / 1601 / 513
Регистрация: 21.02.2017
Сообщений: 4,210
Записей в блоге: 1
23.07.2019, 08:02
Цитата Сообщение от tooru Посмотреть сообщение
puinstaller
*pyinstaller
1
0 / 0 / 0
Регистрация: 02.09.2018
Сообщений: 12
23.07.2019, 17:37  [ТС]
Извиняюсь, вот код setup.py:
Python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# coding: utf-8
 
from cx_Freeze import setup, Executable
 
executables = [Executable('GAME.py',
                          targetName='GAME.exe',
                          base='Win32GUI',
                          icon='app.ico')]
 
options = {
    'build_exe': {
        'include_msvcr': True,
        "packages":["pygame"],
        "include_files":["data"],
       
    }
}
 
setup(name='GAME',
      version='1.0',
      description='Игра Angry birds fruits',
      executables=executables,
      options=options)
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
BasicMan
Эксперт
29316 / 5623 / 2384
Регистрация: 17.02.2009
Сообщений: 30,364
Блог
23.07.2019, 17:37
Помогаю со студенческими работами здесь

Сборка через палочку cx_Freeze, в чемодан EXE
Сборка тварей, через палочку cx_Freeze, в чемодан EXE Используем python 3.7.8 и модуль cx_Freeze ...

Как добавить иконку к exe файлу в cx_Freeze?
Подскажите пожалуйста как и в каком месте нужно указать путь к ico в файле setup.py при создании exe с помощь cx_Freeze. Вот пример...

не открывается exe файл
комп не читает exe файлы пробовал делать откат,но ничего не выходит ,пишет неудоеться запустить востоновление системы.пробовал Windows...

Не открывается .exe файл
Здравствуйте. Столкнулся с такой проблемой: в самом qt creator программа сборку производит и там все нормально. Когда запускаю с папки...

При копировании exe файла с другого компа на котором он работает, на моём при его запуске открывается cmd на несколько секунд и сам exe файл удаляется
Помогите очень надо!!! Дело в следующем: в автошколе на компах установлены программы для тестирования ПДД, ну я чтоб дома тоже их решать...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
4
Ответ Создать тему
Новые блоги и статьи
Символьное дифференцирование
igorrr37 13.02.2026
/ * Логарифм записывается как: (x-2)log(x^2+2) - означает логарифм (x^2+2) по основанию (x-2). Унарный минус обозначается как ! */ #include <iostream> #include <stack> #include <cctype>. . .
Камера Toupcam IUA500KMA
Eddy_Em 12.02.2026
Т. к. у всяких "хикроботов" слишком уж мелкий пиксель, для подсмотра в ESPriF они вообще плохо годятся: уже 14 величину можно рассмотреть еле-еле лишь на экспозициях под 3 секунды (а то и больше),. . .
И ясному Солнцу
zbw 12.02.2026
И ясному Солнцу, и светлой Луне. В мире покоя нет и люди не могут жить в тишине. А жить им немного лет.
«Знание-Сила»
zbw 12.02.2026
«Знание-Сила» «Время-Деньги» «Деньги -Пуля»
SDL3 для Web (WebAssembly): Подключение Box2D v3, физика и отрисовка коллайдеров
8Observer8 12.02.2026
Содержание блога Box2D - это библиотека для 2D физики для анимаций и игр. С её помощью можно определять были ли коллизии между конкретными объектами и вызывать обработчики событий столкновения. . . .
SDL3 для Web (WebAssembly): Загрузка PNG с прозрачным фоном с помощью SDL_LoadPNG (без SDL3_image)
8Observer8 11.02.2026
Содержание блога Библиотека SDL3 содержит встроенные инструменты для базовой работы с изображениями - без использования библиотеки SDL3_image. Пошагово создадим проект для загрузки изображения. . .
SDL3 для Web (WebAssembly): Загрузка PNG с прозрачным фоном с помощью SDL3_image
8Observer8 10.02.2026
Содержание блога Библиотека SDL3_image содержит инструменты для расширенной работы с изображениями. Пошагово создадим проект для загрузки изображения формата PNG с альфа-каналом (с прозрачным. . .
Установка Qt-версии Lazarus IDE в Debian Trixie Xfce
volvo 10.02.2026
В общем, достали меня глюки IDE Лазаруса, собранной с использованием набора виджетов Gtk2 (конкретно: если набирать текст в редакторе и вызвать подсказку через Ctrl+Space, то после закрытия окошка. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru