corentin.bollet
12 months ago
1 changed files with 47 additions and 0 deletions
@ -0,0 +1,47 @@ |
|||
import tkinter as tk |
|||
from tkinter import messagebox |
|||
|
|||
from PIL import Image |
|||
|
|||
|
|||
|
|||
class Interface(tk.Frame): |
|||
def __init__(self, master): |
|||
"""initialisation de l'interface : présentation du menu""" |
|||
tk.Frame.__init__(self, master) |
|||
self.grid(row=0) |
|||
#revoir le design |
|||
self.menu = tk.Frame() |
|||
self.menu.grid(row=0) |
|||
title = tk.Label(self.menu, text="Bataille",font=("eufm10", 42)) |
|||
title.grid(row=0) |
|||
|
|||
#image ne fonctionne pas |
|||
#canvas = tk.Canvas(self, width = 300, height = 300) |
|||
#canvas.grid(row=0) |
|||
#img = tk.PhotoImage(file="title_img.png") |
|||
#canvas.create_image(20,20, anchor='nw', image=img) |
|||
|
|||
|
|||
|
|||
jouer_btn = tk.Button(self.menu, text ="Jouer", command=self.jouer) |
|||
jouer_btn.grid(row=1,pady=(30, 0)) |
|||
|
|||
def jouer(self): |
|||
"""interface du jeu""" |
|||
self.clearFrame(self.menu) |
|||
msg=messagebox.showinfo("JEU", "Jeu.") |
|||
|
|||
|
|||
def clearFrame(self, frame): |
|||
# destroy all widgets from frame |
|||
for widget in frame.winfo_children(): |
|||
widget.destroy() |
|||
|
|||
|
|||
if __name__ == "__main__": |
|||
root = tk.Tk() |
|||
root.title("Hello World!") |
|||
root.geometry("300x300") |
|||
hello_frame = Interface(root) |
|||
hello_frame.mainloop() |
Loading…
Reference in new issue