From 62855406d67edeb635bc43a7f92bf00b4710dd55 Mon Sep 17 00:00:00 2001 From: "philippot.m" <> Date: Thu, 20 Mar 2025 20:13:57 +0100 Subject: [PATCH 1/2] tuto --- tuto.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tuto.txt diff --git a/tuto.txt b/tuto.txt new file mode 100644 index 0000000..36fb706 --- /dev/null +++ b/tuto.txt @@ -0,0 +1,17 @@ +Au debut: +Creer un fichier sur votre pc et se mettre dedans clic droit "git bash here" +git config --global user.name "nom.p" +git config --global user.email "" +git clone https://paul-constans.ac-clermont.fr/gitea/laneury.a/basket_arno_mathis_theo.git +git pull + +ajouter un fichier dans git: +git add nom_du_fichier.format (ex:main.py) +git commit -m "le message que l'on veut OBLIGATOIRE" + +mettre a jour fichier/serveur: +git pull +git push + +Aide: +git status #permet de voir ou on en est \ No newline at end of file From 66d8382a8bfb057949db74d29fa1d5970a824e9d Mon Sep 17 00:00:00 2001 From: "philippot.m" <> Date: Thu, 20 Mar 2025 22:15:24 +0100 Subject: [PATCH 2/2] =?UTF-8?q?fonction=20load=20=C3=A0=20voir=20et=20save?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jeu_de_la_vie.py | 69 +++++++++++++++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 24 deletions(-) diff --git a/jeu_de_la_vie.py b/jeu_de_la_vie.py index 4e4bf2a..c722ce6 100644 --- a/jeu_de_la_vie.py +++ b/jeu_de_la_vie.py @@ -1,10 +1,17 @@ -import tkinter as tk +from tkinter import * from copy import deepcopy from time import sleep lst_c=[] lst_grille=[] f_cont=[] ########Fonction interface utilisateur########### +def bouton_grille(): + global nb_ligne + global nb_colonne + nb_ligne=nb_ligne_choisi.get() + nb_colonne=nb_colonne_choisi.get() + creer_grille() + def creer_grille(): global taille_carré global lst_c @@ -15,8 +22,6 @@ def creer_grille(): for detruire_col in range(0,len(lst_c[0])): zone.delete(lst_c[detruire_l][detruire_col]) ##############création_grille########## - nb_ligne=nb_ligne_choisi.get() - nb_colonne=nb_colonne_choisi.get() grille =[] lst_grille=[] for ligne in range(0,nb_ligne): @@ -109,56 +114,72 @@ def stop(): #########Fonction système sauvegarde######## def save(): state=open("grille_jeu.txt","w") - state.write("[[") + state.write("[") for ligne in range (0,len(grille)): - if ligne!=0 or ligne==len(grille)-1: - state.write("],[") + if ligne!=0: + print("a") + state.write("""]'[""") for col in range (0,len(grille[0])): if col == len(grille[0])-1: + print(col,len(grille[0])-1) state.write(str(grille[ligne][col])) else: state.write(str(grille[ligne][col])+",") - state.write("]]") - + state.write("]") def load(): - new_state=open(tk.filedialog.askopenfilename(initialdir = "/",title = "Choisir un fichier",filetypes = (("Text files","*.txt*"),)),"r") + global grille + global nb_ligne + global nb_colonne + #new_state=open(filedialog.askopenfilename(initialdir = "/",title = "Choisir un fichier",filetypes = (("Text files","*.txt*"),)),"r") + new_state=open("grille_jeu.txt","r") + new_state=new_state.read() + print(new_state) + new_state=new_state.split("'") + print(new_state) + for new in range(0,len(new_state)): + 1 + nb_ligne=len(new_state[0]) + print(nb_ligne) + nb_colonne=len(new_state[0][0]) + print(nb_colonne) + creer_grille() ##########Programme principale############## -fenetre = tk.Tk() +fenetre = Tk() fenetre.title("Jeu Amoa") -zone = tk.Canvas(fenetre , height =795 , width =1246 , bg="#ffffff") +zone = Canvas(fenetre , height =795 , width =1246 , bg="#ffffff") zone.grid(row=1,column=2,rowspan=9) ##################Grille#################### -nb_ligne_choisi=tk.IntVar() -mess_ligne=tk.Label(text="Nombre de ligne choisi") +nb_ligne_choisi=IntVar() +mess_ligne=Label(text="Nombre de ligne choisi") mess_ligne.grid(row=1,column=1) -choix_l=tk.Entry(textvariable=nb_ligne_choisi,bd=5) +choix_l=Entry(textvariable=nb_ligne_choisi,bd=5) choix_l.grid(row=2,column=1) -nb_colonne_choisi=tk.IntVar() -mess_col=tk.Label(text="Nombre de colone choisi") +nb_colonne_choisi=IntVar() +mess_col=Label(text="Nombre de colone choisi") mess_col.grid(row=3,column=1) -choix_col=tk.Entry(textvariable=nb_colonne_choisi,bd=5) +choix_col=Entry(textvariable=nb_colonne_choisi,bd=5) choix_col.grid(row=4,column=1) -bout_g=tk.Button(text="Créer la grille",command= creer_grille) +bout_g=Button(text="Créer la grille",command= bouton_grille) bout_g.grid(row=5,column=1) ################Génération################## -suivant=tk.Button(text="Prochaine génération",command= gen_suiv) +suivant=Button(text="Prochaine génération",command= gen_suiv) suivant.grid(row=6,column=1) -precedent=tk.Button(text="génération précédente",command= gen_prev) +precedent=Button(text="génération précédente",command= gen_prev) precedent.grid(row=7,column=1) -gen_continue=tk.Button(text="Génération en continue",command= gen_cont) +gen_continue=Button(text="Génération en continue",command= gen_cont) gen_continue.grid(row=8,column=1) -stop=tk.Button(text="Stop",command=stop) +stop=Button(text="Stop",command=stop) stop.grid(row=9,column=1) ################Système sauvegarde########## -save=tk.Button(text="Sauvegarder",command=save) +save=Button(text="Sauvegarder",command=save) save.grid(row=4,column=3) -load=tk.Button(text="Charger",command=load) +load=Button(text="Charger",command=load) load.grid(row=5,column=3) zone.bind_all('', change) fenetre.mainloop() \ No newline at end of file