IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Py2exe Python Discussion :

wxPython + MatPlotLib + py2exe


Sujet :

Py2exe Python

  1. #1
    Membre actif
    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    519
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 519
    Points : 298
    Points
    298
    Par défaut wxPython + MatPlotLib + py2exe
    Bonjour,

    J'utilise wxPython, Matplotlib et py2exe.
    voila le .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()
    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
    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']
    				}},
    	)
    Apres compilation, si je lance mon essai1.exe et que je quitte (clic sur la croix de la fenetre) tout ce passe bien.
    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 ?

  2. #2
    Membre actif
    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    519
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 519
    Points : 298
    Points
    298
    Par défaut
    bon apparement, la solution c'est d'embarquer le plot de matplotlib dans un wxDialog ou une wxFrame.

    y a 4 exemples (embedding_in_wx2.py) dans le zip d'exemples la:
    http://matplotlib.sourceforge.net/

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Probleme py2exe avec matplotlib
    Par HelloThury dans le forum Py2exe
    Réponses: 5
    Dernier message: 19/02/2015, 09h01
  2. Python + wxPython + Py2exe avec 64-bits
    Par Ggamer dans le forum Général Python
    Réponses: 12
    Dernier message: 11/11/2011, 10h47
  3. wxPython, MatPlotlib et Py2exe
    Par Ggamer dans le forum Py2exe
    Réponses: 0
    Dernier message: 27/08/2009, 08h07
  4. [Matplotlib] Pb entre Matplotlib et py2exe
    Par ohtoulouse dans le forum Py2exe
    Réponses: 4
    Dernier message: 20/09/2008, 15h47
  5. [py2exe] wxPython et py2exe -> pb de rendu
    Par bibile dans le forum Py2exe
    Réponses: 7
    Dernier message: 14/06/2008, 19h02

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo