Added cx_freeze example (thanks Jerry!)

This commit is contained in:
Luke Campagnola 2014-06-06 15:53:17 -06:00
parent d004b133cd
commit 35856ccaee
2 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,20 @@
import sys
from PyQt4 import QtGui
import pyqtgraph as pg
from pyqtgraph.graphicsItems import TextItem
# For packages that require scipy, these may be needed:
# from scipy.stats import futil
# from scipy.sparse.csgraph import _validation
from pyqtgraph import setConfigOption
pg.setConfigOption('background','w')
pg.setConfigOption('foreground','k')
app = QtGui.QApplication(sys.argv)
pw = pg.plot(x = [0, 1, 2, 4], y = [4, 5, 9, 6])
pw.showGrid(x=True,y=True)
text = pg.TextItem(html='<div style="text-align: center"><span style="color: #000000;"> %s</span></div>' % "here",anchor=(0.0, 0.0))
text.setPos(1.0, 5.0)
pw.addItem(text)
status = app.exec_()
sys.exit(status)

View File

@ -0,0 +1,36 @@
# Build with `python setup.py build_exe`
from cx_Freeze import setup, Executable
import shutil
from glob import glob
# Remove the build folder
shutil.rmtree("build", ignore_errors=True)
shutil.rmtree("dist", ignore_errors=True)
import sys
includes = ['PyQt4.QtCore', 'PyQt4.QtGui', 'sip', 'pyqtgraph.graphicsItems',
'numpy', 'atexit']
excludes = ['cvxopt','_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger',
'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl','tables',
'Tkconstants', 'Tkinter', 'zmq','PySide','pysideuic','scipy','matplotlib']
if sys.version[0] == '2':
# causes syntax error on py2
excludes.append('PyQt4.uic.port_v3')
base = None
if sys.platform == "win32":
base = "Win32GUI"
build_exe_options = {'excludes': excludes,
'includes':includes, 'include_msvcr':True,
'compressed':True, 'copy_dependent_files':True, 'create_shared_zip':True,
'include_in_shared_zip':True, 'optimize':2}
setup(name = "cx_freeze plot test",
version = "0.1",
description = "cx_freeze plot test",
options = {"build_exe": build_exe_options},
executables = [Executable("plotTest.py", base=base)])