Bonjour, se suis débutant, j'ai consulter des pages et des vidéo pour apprendre, mais personne explique comment remplacer une Frame ou LabelFrame en cours d'affichage par une autre
après une action dans un menu merci a l'avance de vos exemples.

voici un programme qui va additionner les LabelFrame mais pas les remplacer, en fait je cherche a faire un CLS de la page pour ma nouvelle LabelFrame.

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
35
36
37
38
39
40
41
42
43
 
""" librairies """
from tkinter import *
 
""" création de la fenètre """
test_win = Tk()
scren_widht = test_win.winfo_screenwidth()
scren_height = test_win.winfo_screenheight()
widht_wim = (scren_widht/3)
height_win = (scren_height/3)
x_coord = (scren_widht/2) - (widht_wim/2)
y_coord = (scren_height/2) - (height_win/2)
test_win.geometry(("%dx%d+%d+%d") % (widht_wim, height_win, x_coord, y_coord))
test_win.title('DLL MOTEUR WEB V 1.0')
 
""" function """
def s_about():
    about = LabelFrame(test_win, text=" About ", width=50, height=50, bd=1, relief=RAISED)
    about.pack(fill="both", expand="yes", pady=5, padx=10)
 
def s_moteur():
    moteur = LabelFrame(test_win, text=" Moteurs de recherche ", width=50, height=50, bd=1, relief=RAISED)
    moteur.pack(fill="both", expand="yes", pady=5, padx=10)
 
 
 
""" menu principal """
mainmenu = Menu(test_win)
 
menu1 = Menu(mainmenu)
menu1.add_command(label="Moteurs", command=s_moteur)
menu1.add_command(label="Lien de page web")
mainmenu.add_cascade(label="RECHERCHE", menu=menu1)
 
menu2 = Menu(mainmenu)
menu2.add_command(label="About", command=s_about)
mainmenu.add_cascade(label="AIDE", menu=menu2)
 
 
 
""" boucle principale """
test_win.config(menu=mainmenu)
test_win.mainloop()