Bonjour,
J'utilise wxPython, Matplotlib et py2exe.
voila le .py
et le setup.py
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 from wxPython.wx import * import pickle import os import sys import copy import matplotlib matplotlib.use('WX') import matplotlib.backends.backend_wx from pylab import * class Form1(wxPanel): def __init__(self, parent, id): wxPanel.__init__(self, parent, id) self.t1 = wxTextCtrl(self, -1, "200", size=(80, -1), pos=(30,50)) b = wxButton(self, 10, "Affiche", (120, 50)) EVT_BUTTON(self, 10, self.OnClick) self.Show(True) def OnClick(self, event): dt=0.00001 t_end=0.01 f_val=self.t1.GetValue() f=float(f_val) x=arange(0, t_end+dt, dt) y=cos(2*3.14*f*x) figure(0) plot(x, y, linewidth=1.0) show() app = wxPySimpleApp() frame = wxFrame(None, -1, " essai") Form1(frame,-1) frame.Show(1) app.MainLoop()
Apres compilation, si je lance mon essai1.exe et que je quitte (clic sur la croix de la fenetre) tout ce passe bien.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 from distutils.core import setup import glob import py2exe data = glob.glob(r'C:\Python24\share\matplotlib\*') setup(windows=["essai1.py"], data_files=[("matplotlibdata",data)], options = {"py2exe": # optimize may break pylab docstring handling {"packages": ['encodings', 'pytz', 'dateutil', 'numarray', 'matplotlib.numerix.random_array'] }}, )
Si maintenant j'appuie sur le bouton AFFICHE, ca affiche bien le graph. ensuite je quitte le graph et je quitte l'appli. ca quitte bien, mais il reste essai1.exe dans les processus (je suis sous WindowsXP)
est-ce que qqu'un sait pourquoi ?
c'est mon setup.py qui n'est pas au point ?
Partager