py2exe 转换 pytetris

首先,需要一个给 py2exe 使用的 python 脚本,我命名为 setup.py,内容如下:

1 from  distutils.core  import  setup
2 import  glob, shutil
3 import  py2exe
4 setup(windows = [ " main.py " ])
5 shutil.copytree( ' SFX ' ' dist/SFX ' )
6 shutil.copytree( ' Image ' ' dist/Image ' )
7 shutil.copyfile( ' C:/Python25/Lib/site-packages/pygame/freesansbold.ttf ' ' dist/freesansbold.ttf ' )

并对 main.py 做简单的处理

1 # font = pygame.font.Font(None, 40)
2  font  =  pygame.font.Font( ' freesansbold.ttf ' 40 )

最后,执行如下命令:

python setup.py py2exe

.........................................................
关于 py2exe
简介
py2exe is a
Python Distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python installation.
下载
http://sourceforge.net/projects/py2exe/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值