|
@ -1,24 +1,42 @@ |
|
|
import tkinter as tk |
|
|
from tkinter import * |
|
|
from tkinter import ttk |
|
|
|
|
|
from tkinter.messagebox import showinfo |
|
|
from tkinter.messagebox import showinfo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class App(tk.Tk): |
|
|
class Accueil(Tk): |
|
|
def __init__(self, nom): |
|
|
"""interface graphique pour les paramètres""" |
|
|
|
|
|
def __init__(self): |
|
|
super().__init__() |
|
|
super().__init__() |
|
|
|
|
|
|
|
|
# root |
|
|
# root |
|
|
self.title(nom) |
|
|
self.title("Jeu de rôle") |
|
|
self.geometry('500x500') |
|
|
self.geometry('500x500') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
titre = Label(self, text="Bienvenue", font=("Arial", 42)).pack() |
|
|
|
|
|
sous_titre = Label(self, text="Veuillez Choisir un personnage", font=("Arial", 10)).pack() |
|
|
|
|
|
#choix du personnage |
|
|
|
|
|
frameChoixPerso = LabelFrame(self, text="Choix du personnage", padx=20, pady=20) |
|
|
|
|
|
frameChoixPerso.pack(fill="both", expand="yes") |
|
|
|
|
|
|
|
|
|
|
|
Label(frameChoixPerso, text="A l'intérieure de la frame").pack() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
choixPerso = Listbox(frameChoixPerso) |
|
|
|
|
|
self.listePersos = ["guerrier","magicien","voleur","elfe"] |
|
|
|
|
|
for i in range(len(self.listePersos)): |
|
|
|
|
|
choixPerso.insert(i, self.listePersos[i]) |
|
|
|
|
|
|
|
|
|
|
|
choixPerso.pack() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def add_label(self, txt): |
|
|
def add_label(self, txt): |
|
|
ttk.Label(self, text=txt).pack() |
|
|
Label(self, text=txt).pack() |
|
|
|
|
|
|
|
|
def add_entry(self, default): |
|
|
def add_entry(self, default): |
|
|
entry_value = default |
|
|
self.entry_value = default |
|
|
ttk.Entry(self, textvariable=entry_value, width=30).pack() |
|
|
Entry(self, textvariable=self.entry_value, width=30).pack() |
|
|
|
|
|
|
|
|
class FenetreCombat(tk.Tk): |
|
|
class FenetreCombat(Tk): |
|
|
def __init__(self, nom, texte_de_presentation): |
|
|
def __init__(self, nom, texte_de_presentation): |
|
|
"""initialise une interface graphique pour un combat""" |
|
|
"""initialise une interface graphique pour un combat""" |
|
|
self.root = App(nom) |
|
|
self.root = App(nom) |
|
@ -27,16 +45,14 @@ class FenetreCombat(tk.Tk): |
|
|
|
|
|
|
|
|
self.root.add_label("bonjour") |
|
|
self.root.add_label("bonjour") |
|
|
self.root.add_entry("sodvuhmwsoudvhmwsouvh") |
|
|
self.root.add_entry("sodvuhmwsoudvhmwsouvh") |
|
|
self.root.add_label(entry_value) |
|
|
|
|
|
|
|
|
|
|
|
combat_btn = tk.Button(self.root, text="Combattre", command=self.combattre) |
|
|
combat_btn = Button(self.root, text="Combattre", command=self.combattre) |
|
|
pasCombat_btn = tk.Button(self.root, text="Ne pas combattre", command=self.pasCombattre) |
|
|
pasCombat_btn = Button(self.root, text="Ne pas combattre", command=self.pasCombattre) |
|
|
def combattre(self): |
|
|
def combattre(self): |
|
|
pass |
|
|
pass |
|
|
def pasCombattre(self): |
|
|
def pasCombattre(self): |
|
|
pass |
|
|
pass |
|
|
app = FenetreCombat("sdf", "txt pre") |
|
|
def fenetreCombat(nom, texte_de_presentation): |
|
|
|
|
|
root = App(nom) |
|
|
|
|
|
root.add_label("bonjour") |
|
|
|
|
|
root.add_entry("sodvuhmwsoudvhmwsouvh") |
|
|
|
|
|
|
|
|