Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 12/07/2008, à 18:06

g_barthe

[Résolu] Fermeture application mais process toujours la

Bonsoir,

J'ai une application python avec GUI wxpython qui parait plutot bien fonctionner.

Mais je veux la distribuer pour les utilisateurs de windows et linux. Donc je passe par py2exe pour faire un .exe

Et si j'exécute mon fichier exe, à la fermeture de l'application, le processus lié à mon application est toujours actif dans le gestionnaire de processus windows.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# generated by wxGlade 0.6.3 on Sat May 17 16:26:08 2008
#
#   This file is part of AstuGeClim.
#
#    AstuGeClim is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    AstuGeClim is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with emesene; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

import wx
import psyco
from gui_a_propos import *
from gui_pas_developpee import *
from gui_app_dah import *
from gui_ventil_lt_froid import *

# begin wxGlade: extracode
# end wxGlade

class MyFrame_astugeclim(wx.Frame):
    def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame_astugeclim.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        
        # Menu Bar
        self.frame_astugeclim_menubar = wx.MenuBar()
        wxglade_tmp_menu = wx.Menu()
        self.frame_astugeclim_menubar.Append(wxglade_tmp_menu, "Fichier")
        wxglade_tmp_menu = wx.Menu()
        self.frame_astugeclim_menubar.Append(wxglade_tmp_menu, "?")
        self.SetMenuBar(self.frame_astugeclim_menubar)
        # Menu Bar end
        self.b_dah = wx.BitmapButton(self, -1, wx.Bitmap("images/dah.png", wx.BITMAP_TYPE_ANY))
        self.label_2 = wx.StaticText(self, -1, u"Données du DAH")
        self.b_acoustique = wx.BitmapButton(self, -1, wx.Bitmap("images/acoustique.png", wx.BITMAP_TYPE_ANY))
        self.label_8 = wx.StaticText(self, -1, "Acoustique")
        self.label_19 = wx.StaticText(self, -1, "")
        self.label_13 = wx.StaticText(self, -1, "")
        self.bitmap_button_1 = wx.BitmapButton(self, -1, wx.Bitmap("images/katuberling.png", wx.BITMAP_TYPE_ANY))
        self.label_3 = wx.StaticText(self, -1, "BCP")
        self.bitmap_button_5 = wx.BitmapButton(self, -1, wx.Bitmap("images/katuberling.png", wx.BITMAP_TYPE_ANY))
        self.label_9 = wx.StaticText(self, -1, "Dimensionnement CTA")
        self.label_20 = wx.StaticText(self, -1, "")
        self.label_14 = wx.StaticText(self, -1, "")
        self.bitmap_button_2 = wx.BitmapButton(self, -1, wx.Bitmap("images/katuberling.png", wx.BITMAP_TYPE_ANY))
        self.label_4 = wx.StaticText(self, -1, "Vase d'expansion")
        self.bitmap_button_6 = wx.BitmapButton(self, -1, wx.Bitmap("images/katuberling.png", wx.BITMAP_TYPE_ANY))
        self.label_10 = wx.StaticText(self, -1, "Pdc hydraulique")
        self.label_21 = wx.StaticText(self, -1, "")
        self.label_15 = wx.StaticText(self, -1, "")
        self.bitmap_button_3 = wx.BitmapButton(self, -1, wx.Bitmap("images/katuberling.png", wx.BITMAP_TYPE_ANY))
        self.label_5 = wx.StaticText(self, -1, "Socle de pompe")
        self.bitmap_button_7 = wx.BitmapButton(self, -1, wx.Bitmap("images/katuberling.png", wx.BITMAP_TYPE_ANY))
        self.label_11 = wx.StaticText(self, -1, u"PDC aéraulique")
        self.label_22 = wx.StaticText(self, -1, "")
        self.label_16 = wx.StaticText(self, -1, "")
        self.bitmap_button_4 = wx.BitmapButton(self, -1, wx.Bitmap("images/katuberling.png", wx.BITMAP_TYPE_ANY))
        self.label_6 = wx.StaticText(self, -1, "Siphon de condensats")
        self.b_ventil_lt_froid = wx.BitmapButton(self, -1, wx.Bitmap("images/ventil_lt_froid.gif", wx.BITMAP_TYPE_ANY))
        self.label_12 = wx.StaticText(self, -1, "Ventilation LT froid")
        self.label_23 = wx.StaticText(self, -1, "")
        self.label_17 = wx.StaticText(self, -1, "")
        self.b_quitter = wx.BitmapButton(self, -1, wx.Bitmap("images/exit.png", wx.BITMAP_TYPE_ANY))
        self.label_7 = wx.StaticText(self, -1, "")
        self.b_help = wx.BitmapButton(self, -1, wx.Bitmap("images/help.png", wx.BITMAP_TYPE_ANY))
        self.label_18 = wx.StaticText(self, -1, "")
        self.b_info = wx.BitmapButton(self, -1, wx.Bitmap("images/info.gif", wx.BITMAP_TYPE_ANY))
        self.label_1 = wx.StaticText(self, -1, "")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.ouvrir_dah, self.b_dah)
        self.Bind(wx.EVT_BUTTON, self.ouvrir_acoustique, self.b_acoustique)
        self.Bind(wx.EVT_BUTTON, self.ouvrir_bcp, self.bitmap_button_1)
        self.Bind(wx.EVT_BUTTON, self.ouvrir_cta, self.bitmap_button_5)
        self.Bind(wx.EVT_BUTTON, self.ouvrir_ve, self.bitmap_button_2)
        self.Bind(wx.EVT_BUTTON, self.ouvrir_pdc_hydrau, self.bitmap_button_6)
        self.Bind(wx.EVT_BUTTON, self.ouvrir_socle_pompe, self.bitmap_button_3)
        self.Bind(wx.EVT_BUTTON, self.ouvrir_pdc_aerau, self.bitmap_button_7)
        self.Bind(wx.EVT_BUTTON, self.ouvrir_siphon_condensats, self.bitmap_button_4)
        self.Bind(wx.EVT_BUTTON, self.ouvrir_ventil_lt_froid, self.b_ventil_lt_froid)
        self.Bind(wx.EVT_BUTTON, self.quitter_astugeclim, self.b_quitter)
        self.Bind(wx.EVT_BUTTON, self.aide_astugeclim, self.b_help)
        self.Bind(wx.EVT_BUTTON, self.afficher_infos, self.b_info)
        # end wxGlade

    def __set_properties(self):
        self.SetBackgroundColour(wx.Colour(216, 216, 191))
        self.label_2.SetBackgroundColour(wx.Colour(216, 216, 191))
        self.label_3.SetBackgroundColour(wx.Colour(216, 216, 191))
        self.label_4.SetBackgroundColour(wx.Colour(216, 216, 191))
        self.label_5.SetBackgroundColour(wx.Colour(216, 216, 191))
        self.label_6.SetBackgroundColour(wx.Colour(216, 216, 191))
        self.label_7.SetBackgroundColour(wx.Colour(216, 216, 191))
        self.label_8.SetBackgroundColour(wx.Colour(216, 216, 191))
        self.label_9.SetBackgroundColour(wx.Colour(216, 216, 191))
        self.label_10.SetBackgroundColour(wx.Colour(216, 216, 191))
        self.label_11.SetBackgroundColour(wx.Colour(216, 216, 191))
        self.label_12.SetBackgroundColour(wx.Colour(216, 216, 191))
        # begin wxGlade: MyFrame_astugeclim.__set_properties
        self.SetTitle("AstuGeClim")
        self.b_dah.SetSize(self.b_dah.GetBestSize())
        self.b_acoustique.SetSize(self.b_acoustique.GetBestSize())
        self.bitmap_button_1.SetSize(self.bitmap_button_1.GetBestSize())
        self.bitmap_button_5.SetSize(self.bitmap_button_5.GetBestSize())
        self.bitmap_button_2.SetSize(self.bitmap_button_2.GetBestSize())
        self.bitmap_button_6.SetSize(self.bitmap_button_6.GetBestSize())
        self.bitmap_button_3.SetSize(self.bitmap_button_3.GetBestSize())
        self.bitmap_button_7.SetSize(self.bitmap_button_7.GetBestSize())
        self.bitmap_button_4.SetSize(self.bitmap_button_4.GetBestSize())
        self.b_ventil_lt_froid.SetSize(self.b_ventil_lt_froid.GetBestSize())
        self.b_quitter.SetSize(self.b_quitter.GetBestSize())
        self.b_help.SetSize(self.b_help.GetBestSize())
        self.b_info.SetSize(self.b_info.GetBestSize())
        # end wxGlade

    def __do_layout(self):
        # begin wxGlade: MyFrame_astugeclim.__do_layout
        grid_sizer_1 = wx.GridSizer(6, 6, 0, 0)
        grid_sizer_1.Add(self.b_dah, 0, 0, 0)
        grid_sizer_1.Add(self.label_2, 0, 0, 0)
        grid_sizer_1.Add(self.b_acoustique, 0, 0, 0)
        grid_sizer_1.Add(self.label_8, 0, 0, 0)
        grid_sizer_1.Add(self.label_19, 0, 0, 0)
        grid_sizer_1.Add(self.label_13, 0, 0, 0)
        grid_sizer_1.Add(self.bitmap_button_1, 0, 0, 0)
        grid_sizer_1.Add(self.label_3, 0, 0, 0)
        grid_sizer_1.Add(self.bitmap_button_5, 0, 0, 0)
        grid_sizer_1.Add(self.label_9, 0, 0, 0)
        grid_sizer_1.Add(self.label_20, 0, 0, 0)
        grid_sizer_1.Add(self.label_14, 0, 0, 0)
        grid_sizer_1.Add(self.bitmap_button_2, 0, 0, 0)
        grid_sizer_1.Add(self.label_4, 0, 0, 0)
        grid_sizer_1.Add(self.bitmap_button_6, 0, 0, 0)
        grid_sizer_1.Add(self.label_10, 0, 0, 0)
        grid_sizer_1.Add(self.label_21, 0, 0, 0)
        grid_sizer_1.Add(self.label_15, 0, 0, 0)
        grid_sizer_1.Add(self.bitmap_button_3, 0, 0, 0)
        grid_sizer_1.Add(self.label_5, 0, 0, 0)
        grid_sizer_1.Add(self.bitmap_button_7, 0, 0, 0)
        grid_sizer_1.Add(self.label_11, 0, 0, 0)
        grid_sizer_1.Add(self.label_22, 0, 0, 0)
        grid_sizer_1.Add(self.label_16, 0, 0, 0)
        grid_sizer_1.Add(self.bitmap_button_4, 0, 0, 0)
        grid_sizer_1.Add(self.label_6, 0, 0, 0)
        grid_sizer_1.Add(self.b_ventil_lt_froid, 0, 0, 0)
        grid_sizer_1.Add(self.label_12, 0, 0, 0)
        grid_sizer_1.Add(self.label_23, 0, 0, 0)
        grid_sizer_1.Add(self.label_17, 0, 0, 0)
        grid_sizer_1.Add(self.b_quitter, 0, 0, 0)
        grid_sizer_1.Add(self.label_7, 0, 0, 0)
        grid_sizer_1.Add(self.b_help, 0, 0, 0)
        grid_sizer_1.Add(self.label_18, 0, 0, 0)
        grid_sizer_1.Add(self.b_info, 0, 0, 0)
        grid_sizer_1.Add(self.label_1, 0, 0, 0)
        self.SetSizer(grid_sizer_1)
        grid_sizer_1.Fit(self)
        self.Layout()
        # end wxGlade

    def ouvrir_dah(self, event): # wxGlade: MyFrame_astugeclim.<event_handler>
        #print "Event handler `ouvrir_dah' not implemented"
	frame_01 = MyFrame(None, -1, "")
	app.SetTopWindow(frame_01)
	frame_01.Show()
	app.MainLoop()
        event.Skip()

    def ouvrir_acoustique(self, event): # wxGlade: MyFrame_astugeclim.<event_handler>
        #print "Event handler `ouvrir_acoustique' not implemented"
	frame_02 = MyFrame_pas_cree(None, -1, "")
	app.SetTopWindow(frame_02)
	frame_02.Show()
	app.MainLoop()
        event.Skip()

    def quitter_astugeclim(self, event): # wxGlade: MyFrame_astugeclim.<event_handler>
        #print "Event handler `quitter_astugeclim' not implemented"
	self.Destroy()
        event.Skip()

    def aide_astugeclim(self, event): # wxGlade: MyFrame_astugeclim.<event_handler>
        #print "Event handler `aide_astugeclim' not implemented"
	frame_03 = MyFrame_pas_cree(None, -1, "")
	app.SetTopWindow(frame_03)
	frame_03.Show()
	app.MainLoop()
        event.Skip()

    def afficher_infos(self, event): # wxGlade: MyFrame_astugeclim.<event_handler>
        #print "Event handler `afficher_infos' not implemented"
        frame_04 = MyFrame_a_propos(None, -1, "")
        app.SetTopWindow(frame_04)
	frame_04.Show()
	app.MainLoop()
	event.Skip()

    def ouvrir_bcp(self, event): # wxGlade: MyFrame_astugeclim.<event_handler>
        #print "Event handler `ouvrir_bcp' not implemented"
        frame_05 = MyFrame_pas_cree(None, -1, "")
        app.SetTopWindow(frame_05)
	frame_05.Show()
	app.MainLoop()
	event.Skip()

    def ouvrir_cta(self, event): # wxGlade: MyFrame_astugeclim.<event_handler>
        #print "Event handler `ouvrir_cta' not implemented"
        frame_06 = MyFrame_pas_cree(None, -1, "")
        app.SetTopWindow(frame_06)
	frame_06.Show()
	app.MainLoop()
	event.Skip()

    def ouvrir_ve(self, event): # wxGlade: MyFrame_astugeclim.<event_handler>
        #print "Event handler `ouvrir_ve' not implemented"
        frame_07 = MyFrame_pas_cree(None, -1, "")
        app.SetTopWindow(frame_07)
	frame_07.Show()
	app.MainLoop()
	event.Skip()

    def ouvrir_pdc_hydrau(self, event): # wxGlade: MyFrame_astugeclim.<event_handler>
        #print "Event handler `ouvrir_pdc_hydrau' not implemented"
        frame_08 = MyFrame_pas_cree(None, -1, "")
        app.SetTopWindow(frame_08)
	frame_08.Show()
	app.MainLoop()
	event.Skip()

    def ouvrir_socle_pompe(self, event): # wxGlade: MyFrame_astugeclim.<event_handler>
        #print "Event handler `ouvrir_socle_pompe' not implemented"
        frame_09 = MyFrame_pas_cree(None, -1, "")
        app.SetTopWindow(frame_09)
	frame_09.Show()
	app.MainLoop()
	event.Skip()

    def ouvrir_pdc_aerau(self, event): # wxGlade: MyFrame_astugeclim.<event_handler>
        #print "Event handler `ouvrir_pdc_aerau' not implemented"
        frame_10 = MyFrame_pas_cree(None, -1, "")
        app.SetTopWindow(frame_10)
	frame_10.Show()
	app.MainLoop()
	event.Skip()

    def ouvrir_siphon_condensats(self, event): # wxGlade: MyFrame_astugeclim.<event_handler>
        #print "Event handler `ouvrir_siphon_condensats' not implemented"
        frame_11 = MyFrame_pas_cree(None, -1, "")
        app.SetTopWindow(frame_11)
	frame_11.Show()
	app.MainLoop()
	event.Skip()

    def ouvrir_ventil_lt_froid(self, event): # wxGlade: MyFrame_astugeclim.<event_handler>
        #print "Event handler `ouvrir_ventil_lt_froid' not implemented"
	frame_12 = ventil_lt_froid(None, -1, "")
	app.SetTopWindow(frame_12)
	frame_12.Show()
	app.MainLoop()

# end of class MyFrame_astugeclim

if __name__ == "__main__":
	psyco.full()
	app = wx.PySimpleApp(0)
	wx.InitAllImageHandlers()
	frame_astugeclim = MyFrame_astugeclim(None, -1, "")
	app.SetTopWindow(frame_astugeclim)
	frame_astugeclim.Show()
	app.MainLoop()

Voilà je vous ai mis le code de la page principale. Si ca peut vous aider.

Pourtant il me semble fermer l'application comme il faut "self.Destroy()".

Merci à tous pour un petit coup de main.

Dernière modification par g_barthe (Le 13/07/2008, à 13:30)


Mon forum perso sur le génie climatique http://le-genie-climatique.positifforum.com/
Le forum des travaux manuels : http://pausebroderie.fr/

Hors ligne

#2 Le 13/07/2008, à 13:30

g_barthe

Re : [Résolu] Fermeture application mais process toujours la

hello,

Alors je me répond à moi même.

En fait le processus se coupe environ 20 secondes après la fermeture de l'application.

Ouf.


Mon forum perso sur le génie climatique http://le-genie-climatique.positifforum.com/
Le forum des travaux manuels : http://pausebroderie.fr/

Hors ligne

#3 Le 13/07/2008, à 16:30

aleph

Re : [Résolu] Fermeture application mais process toujours la

> En fait le processus se coupe environ 20 secondes après la fermeture de l'application.

... ce qui n'est pas normal.

#4 Le 13/07/2008, à 16:38

g_barthe

Re : [Résolu] Fermeture application mais process toujours la

euh sad:(:(

Tu m'a pété le moral là.

Tu aurais une explication rationnelle ?

Parce que c'est un phénomène que j'ai retrouvé sur l'application pap'rass développé en python aussi.

Ca m'inquiète si c'est pas normal.


Mon forum perso sur le génie climatique http://le-genie-climatique.positifforum.com/
Le forum des travaux manuels : http://pausebroderie.fr/

Hors ligne

#5 Le 13/07/2008, à 17:17

aleph

Re : [Résolu] Fermeture application mais process toujours la

> g_barthe

Je vais te donner une explication qui ne va pas te plaire mais en voyant l'ensemble des applications que tu proposes depuis fort longtemps, il me semble qu'il y quelque chose qui ne joue pas.

1) Apprends Python
2) Quand tu penses maîtriser un peu Python, commence avec wxPython pas à pas. Sauter sur tout ce qui court sur le web n'est pas la bonne idée.

Je pense sincèrement et vraiment sans reproche que tes problèmes sont là. Combien de classe(s) t'es-tu exercé à écrire dans un console Python ?

#6 Le 13/07/2008, à 18:23

g_barthe

Re : [Résolu] Fermeture application mais process toujours la

Je suis conscient que je suis loin d'être expert en python.

J'avance comme je peux et avec ce que je trouve sur internet.

Je n'ai pas proposé d'application python à part AstuGeClim que je développe depuis 3 mois. Le reste n'a pas porté ses fruits.

Mais là mon application n'est en soi pas très compliquée. Je pensais que ce que je faisais était bien. sad

Aie va falloir que je reprenne des trucs je le sens. Mais tu aurais un exemple de ce qui cloche dans ma façon de faire ?

Je pense perso que je suis encore dans la phase prog évènementielle et pas entièrement prog objet comme python sait si bien le faire. Mais j'ai du mal à changer mes habitudes.


Mon forum perso sur le génie climatique http://le-genie-climatique.positifforum.com/
Le forum des travaux manuels : http://pausebroderie.fr/

Hors ligne

#7 Le 13/07/2008, à 19:52

nicolas66

Re : [Résolu] Fermeture application mais process toujours la

Allez, courage smile


"The computer was born to solve problems that did not exist before." (B. Gates)

Hors ligne