Bonsoir chers tous
Je voudrais ajouter des boutons et supprimer des boutons sur ma fenêtre.
pour l'ajout pas de soucis mais comment écrire la fonction qui peut les supprimer ?
merci


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from tkinter import *
 
fn=Tk()
fn.title("GP")
fn.geometry("780x700")
fn.resizable(height=False,width=False)
fn['bg']='gray98'
#Creation barre horizontale
horizontal_frme=Frame(fn,bg="blue",highlightbackground="white",highlightthickness=1)
horizontal_frme.pack(side=TOP,fill=X)
horizontal_frme.pack_propagate(False)
horizontal_frme.config(height=50)
btn=Button(horizontal_frme,text="☰",font=("Century Gothic",10,"bold"),fg="white",bg="blue",bd=0,activebackground="blue",activeforeground="white")
btn.pack(side=LEFT)
def ajouter():
        espc=Button(fn,text="ESPC",font=("Century Gothic",10,"bold"),height=2,width=20)
        espc.place(x=153,y=50)
        psp=Button(fn,text="NPSP",font=("Century Gothic",10,"bold"),height=2,width=20)
        psp.place(x=153,y=100)
        ent=Button(fn,text="Entrants",font=("Century Gothic",10,"bold"),height=2,width=20)
        ent.place(x=153,y=150)
 
#def supprimer()
 
 
#Creation barre laterale avec les boutons ajouter et supprimer
lateral_frme=Frame(fn,bg="blue")
lateral_frme.place(x=0,y=50,height=650,width=150)
suppr=Button(lateral_frme,text="Supprimer Button",font=("Century Gothic",10,"bold"),fg="white",bg="blue",bd=0,activebackground="blue",activeforeground="white")
suppr.place(x=20,y=20)
ajout=Button(lateral_frme,text="Ajouter Button",font=("Century Gothic",10,"bold"),fg="white",bg="blue",bd=0,activebackground="blue",activeforeground="white",command=ajouter)
ajout.place(x=20,y=50)
 
fn.mainloop()