|
|
@ -4,21 +4,39 @@ from tkinter.messagebox import showinfo |
|
|
|
|
|
|
|
|
|
|
|
class App(tk.Tk): |
|
|
|
def __init__(self): |
|
|
|
def __init__(self, nom): |
|
|
|
super().__init__() |
|
|
|
|
|
|
|
# root |
|
|
|
self.title('Jeu de rôle') |
|
|
|
self.title(nom) |
|
|
|
self.geometry('500x500') |
|
|
|
|
|
|
|
# label |
|
|
|
self.label = ttk.Label(self, text='Bienvenue !') |
|
|
|
self.label.pack() |
|
|
|
def add_label(self, txt): |
|
|
|
ttk.Label(self, text=txt).pack() |
|
|
|
|
|
|
|
def add_entry(self, default): |
|
|
|
entry_value = default |
|
|
|
ttk.Entry(self, textvariable=entry_value, width=30).pack() |
|
|
|
|
|
|
|
class FenetreCombat(tk.Tk): |
|
|
|
def __init__(self, nom, texte_de_presentation): |
|
|
|
"""initialise une interface graphique pour un combat""" |
|
|
|
self.root = App(nom) |
|
|
|
|
|
|
|
self.texte_de_presentation = texte_de_presentation |
|
|
|
|
|
|
|
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) |
|
|
|
def combattre(self): |
|
|
|
pass |
|
|
|
def pasCombattre(self): |
|
|
|
pass |
|
|
|
app = FenetreCombat("sdf", "txt pre") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# button |
|
|
|
self.button = ttk.Button(self, text='test') |
|
|
|
self.button['command'] = self.button_clicked |
|
|
|
self.button.pack() |
|
|
|
|
|
|
|
def button_clicked(self): |
|
|
|
showinfo(title='Information', message='Bonjour !') |
|
|
|