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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| #!/usr/bin/python
# -*- coding: iso-8859-15 -*-
#
#
import wx
class Bonjour(wx.Frame):
def __init__(self, titre):
wx.Frame.__init__(self, None,-1, title = titre, size = (200, 100))
conteneur = wx.Panel(self,-1, size = self.GetClientSize())
etiquette = wx.StaticText(conteneur,-1, "Bonjour tout le monde !",
style = wx.ALIGN_CENTRE)
etiquette.CentreOnParent()
class MonApp(wx.App):
def OnInit(self):
fen = Bonjour("Exemple 1")
fen.Show(True)
self.SetTopWindow(fen)
self.Nbre_Partie = 0
self.Game_en_cours = []
wx.CallAfter(self.mafonction)
return True
def mafonction(self):
self.Nbre_Partie += 1
self.Game_en_cours = Game(self.Nbre_Partie)
wx.CallLater(60, self.mafonction)
###---------------------------------------------------------------------------------------------
def Game(Nbre_Partie):
###---------------------------------------------------------------------------------------------
# Initialisation
Partie_en_cours = []
FichierDebugPartie = 'Fichier_Debug_Partie.txt'
##---------------à Supprimer après Debug -----------------------------------------------------------------------------------
EcrireDansFichier(FichierDebugPartie, "\n\n---------------------------------------------------------------------------")
EcrireDansFichier(FichierDebugPartie, "----- Nbre_Partie : " + str(Nbre_Partie) + " ---------------------------------------------------")
EcrireDansFichier(FichierDebugPartie, "---------------------------------------------------------------------------")
##---------------à Supprimer après Debug -----------------------------------------------------------------------------------
return Partie_en_cours[:]
###-------------------------------------------------------------------------
def EcrireDansFichier(nomF1, ligne1):
""" Ecrit "ligne" dans le Fichier "nomF" """
###-------------------------------------------------------------------------
with open(nomF1, 'a') as of1:
of1.write(ligne1 + '\n')
app = MonApp()
app.MainLoop() |
Partager