Skip to content

Commit 32c4345

Browse files
author
Shuge Lee
committed
Added py2exe demo.
1 parent 27c9f1b commit 32c4345

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env python
2+
#coding:utf-8
3+
import sys
4+
from PyQt4 import QtGui
5+
from PyQt4 import QtCore
6+
7+
class Button(QtGui.QWidget):
8+
def __init__(self, parent = None):
9+
QtGui.QWidget.__init__(self, parent)
10+
11+
x, y, w, h = 500, 200, 300, 400
12+
self.setGeometry(x, y, w, h)
13+
14+
x, y, w, h = 190, 190, 96, 32
15+
login_btn = QtGui.QPushButton("Quit", self)
16+
login_btn.setGeometry(x, y, w, h)
17+
18+
login_btn.clicked.connect(self.do_quit)
19+
20+
def do_quit(self):
21+
QtGui.qApp.quit()
22+
23+
def main():
24+
app = QtGui.QApplication(sys.argv)
25+
btn = Button()
26+
btn.show()
27+
sys.exit(app.exec_())
28+
29+
if __name__ == "__main__":
30+
main()
31+
18.9 KB
Binary file not shown.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env python
2+
#-*- coding:utf-8 -*-
3+
import os
4+
import glob
5+
##
6+
from distutils.core import setup
7+
import py2exe
8+
assert py2exe != None
9+
##
10+
osp=os.path
11+
12+
windows = [
13+
{
14+
"script": "btn.py",
15+
"icon_resources": [(1, "gui.ico")],
16+
}
17+
]
18+
options = {
19+
"py2exe": {
20+
"includes": ["PyQt4", "sip"],
21+
"dll_excludes": ["MSVCP90.dll"],
22+
"bundle_files" : 1,
23+
}
24+
}
25+
26+
setup(
27+
name = "foo",
28+
windows = windows,
29+
options = options,
30+
zipfile = None,
31+
)

0 commit comments

Comments
 (0)