Skip to content

Commit 7dd13fe

Browse files
committed
Now we can generate exe from source code.
1 parent 1230658 commit 7dd13fe

38 files changed

+99
-27
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
*__pycache__
22
ranking.json
3+
.idea
File renamed without changes.

24points.spec

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# -*- mode: python ; coding: utf-8 -*-
2+
3+
4+
block_cipher = None
5+
6+
7+
a = Analysis(
8+
['24points.py'],
9+
pathex=[],
10+
binaries=[],
11+
datas=[],
12+
hiddenimports=[],
13+
hookspath=[],
14+
hooksconfig={},
15+
runtime_hooks=[],
16+
excludes=[],
17+
win_no_prefer_redirects=False,
18+
win_private_assemblies=False,
19+
cipher=block_cipher,
20+
noarchive=False,
21+
)
22+
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
23+
24+
exe = EXE(
25+
pyz,
26+
a.scripts,
27+
a.binaries,
28+
a.zipfiles,
29+
a.datas,
30+
[],
31+
name='24points',
32+
debug=False,
33+
bootloader_ignore_signals=False,
34+
strip=False,
35+
upx=True,
36+
upx_exclude=[],
37+
runtime_tmpdir=None,
38+
console=False,
39+
disable_windowed_traceback=False,
40+
argv_emulation=False,
41+
target_arch=None,
42+
codesign_identity=None,
43+
entitlements_file=None,
44+
icon=['res\\images\\24points.ico'],
45+
)

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,24 @@
44
# New Feature will be added
55
1. Add new Release for Windows
66
2. Add docs, such as design, proposal, etc
7+
8+
# convert to exe
9+
1. Install pyinstaller
10+
11+
pip install pyinstaller
12+
2. download source code
13+
14+
git clone https://github.com/rexxar-liang/24points.git
15+
16+
cd 24points
17+
3. generate exe by pyinstaller, the exe file will be in ./dist
18+
19+
pyinstaller.exe -F -w -i res/images/24points.ico 24points.py
20+
21+
or
22+
23+
pyinstaller.exe 24points.spec
24+
4. move 24points.exe
25+
26+
cp dist/24points.exe .
27+
5. run 24points
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import random
22

3-
from point.caculator import checker
3+
from caculator import checker
44

55
possible_brackets = [(None, None, None, None, None, None),
66
('(', None, ')', None, None, None),
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pygame as pg
22

3-
from point.config.setting import Settings
3+
from configuration.setting import Settings
44

55

66
class Bracket:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
import pygame as pg
33

4-
from point.config.setting import Settings
4+
from configuration.setting import Settings
55

66

77
class Button:
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import pygame as pg
22

3-
from point.config.setting import Settings
4-
from point.caculator import checker
3+
from configuration.setting import Settings
4+
from caculator import checker
55

66

77
# 播放音乐,如果成功,播放正确音乐,否则播放错误音乐
88
def _play_music(correct):
99
if correct:
10-
pg.mixer.music.load("sound/correct.wav")
10+
pg.mixer.music.load("res/sound/correct.wav")
1111
else:
12-
pg.mixer.music.load("sound/fault.wav")
12+
pg.mixer.music.load("res/sound/fault.wav")
1313

1414
pg.mixer.music.play()
1515

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
import pygame as pg
33

4-
from point.config.setting import Settings
4+
from configuration.setting import Settings
55

66

77
class Number:
@@ -20,8 +20,9 @@ def __init__(self, game, index, number):
2020
self.image = None
2121
self.type = "SELECT_NUMBER"
2222
self.index = index
23+
self.number_path = self.settings.number_path
2324

24-
self.image = pg.image.load("images/numbers/" + str(number) + ".jpeg")
25+
self.image = pg.image.load(self.number_path + str(number) + ".jpeg")
2526
self.bg_rect = pg.Rect(self.pos[index - 1][0],
2627
self.pos[index - 1][1],
2728
self.width + self.selected_border * 2,
@@ -62,7 +63,7 @@ def unselect(self):
6263
def set_number(self, number):
6364
self.number = number
6465
if number:
65-
self.image = pg.image.load("images/numbers/" + str(number) + ".jpeg")
66+
self.image = pg.image.load(self.number_path + str(number) + ".jpeg")
6667
self.image = pg.transform.scale(self.image, (self.width, self.height))
6768
else:
6869
self.image = None

0 commit comments

Comments
 (0)