|
|
@ -1,24 +1,42 @@ |
|
|
|
import tkinter as tk |
|
|
|
from tkinter import ttk |
|
|
|
from tkinter import * |
|
|
|
from tkinter.messagebox import showinfo |
|
|
|
|
|
|
|
|
|
|
|
class App(tk.Tk): |
|
|
|
def __init__(self, nom): |
|
|
|
class Accueil(Tk): |
|
|
|
"""interface graphique pour les paramètres""" |
|
|
|
def __init__(self): |
|
|
|
super().__init__() |
|
|
|
|
|
|
|
# root |
|
|
|
self.title(nom) |
|
|
|
self.title("Jeu de rôle") |
|
|
|
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): |
|
|
|
ttk.Label(self, text=txt).pack() |
|
|
|
Label(self, text=txt).pack() |
|
|
|
|
|
|
|
def add_entry(self, default): |
|
|
|
entry_value = default |
|
|
|
ttk.Entry(self, textvariable=entry_value, width=30).pack() |
|
|
|
self.entry_value = default |
|
|
|
Entry(self, textvariable=self.entry_value, width=30).pack() |
|
|
|
|
|
|
|
class FenetreCombat(tk.Tk): |
|
|
|
class FenetreCombat(Tk): |
|
|
|
def __init__(self, nom, texte_de_presentation): |
|
|
|
"""initialise une interface graphique pour un combat""" |
|
|
|
self.root = App(nom) |
|
|
@ -27,16 +45,14 @@ class FenetreCombat(tk.Tk): |
|
|
|
|
|
|
|
self.root.add_label("bonjour") |
|
|
|
self.root.add_entry("sodvuhmwsoudvhmwsouvh") |
|
|
|
self.root.add_label(entry_value) |
|
|
|
|
|
|
|
combat_btn = tk.Button(self.root, text="Combattre", command=self.combattre) |
|
|
|
pasCombat_btn = tk.Button(self.root, text="Ne pas combattre", command=self.pasCombattre) |
|
|
|
combat_btn = Button(self.root, text="Combattre", command=self.combattre) |
|
|
|
pasCombat_btn = Button(self.root, text="Ne pas combattre", command=self.pasCombattre) |
|
|
|
def combattre(self): |
|
|
|
pass |
|
|
|
def pasCombattre(self): |
|
|
|
pass |
|
|
|
app = FenetreCombat("sdf", "txt pre") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def fenetreCombat(nom, texte_de_presentation): |
|
|
|
root = App(nom) |
|
|
|
root.add_label("bonjour") |
|
|
|
root.add_entry("sodvuhmwsoudvhmwsouvh") |
|
|
|