Bonsoir,

Alors voilà je suis sur un projet Python qui a pour but de gérer des .txt, je ne suis pas du tout avancé en python je m'aide énormément avec internet.

J'ai fais deux fenêtre tkinter, une fenêtre principale avec tous les outils, à chaque outils une sous fenêtre lui est attribué.

Interface principale:

Nom : Screenshot_2.png
Affichages : 1411
Taille : 5,2 Ko

Là j'aimerai faire en sorte que lorsqu'on clique sur "Anti-Duplicate" ça me switch sur cette fenêtre là:

Nom : Screenshot_3.png
Affichages : 1061
Taille : 4,9 Ko

Et malheureusement j'ai beau chercher sur internet, je vois beaucoup de switch entre label mais pas avec des fenêtres.
J'aimerai vraiment que ça switch de fenêtre, et non que ouvre juste l'autre par dessus.

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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#coding:utf-8
 
from tkinter import *
import os
import tkinter as tk
import webbrowser 
from tkinter import messagebox
import subprocess
import time
 
#Customisation Bouton:
 
class HoverButton(tk.Button):
    def __init__(self, master, **kw):
        tk.Button.__init__(self,master=master,**kw)
        self.defaultBackground = self["background"]
        self.bind("<Enter>", self.on_enter)
        self.bind("<Leave>", self.on_leave)
 
    def on_enter(self, e):
        self['background'] = self['activebackground']
 
    def on_leave(self, e):
        self['background'] = self.defaultBackground
 
#---------------------------------------------------------------------
 
#Fenêtre Anti-Duplicate:
 
def Anti_Duplicate():
 
    global Anti_Duplicate
    A_Duplicate = Tk()
    A_Duplicate.resizable(width=False, height=False)
    screenn_x = int(A_Duplicate.winfo_screenwidth())
    A_Duplicate.config(background='#1c2028')
    screenn_y = int(A_Duplicate.winfo_screenheight()) 
    A_Duplicate.title("Anti-Duplicate v0.0.1")
    windowss_x = 570
    windowss_y = 340
 
    possX = (screenn_x // 2) - (windowss_x // 2)
    possY = (screenn_y // 2) - (windowss_y // 2)
 
    geoo = "{}x{}+{}+{}".format(windowss_x, windowss_y, possX, possY)
    A_Duplicate.geometry(geoo)
 
    mainframe = Frame(A_Duplicate, bg='#1c2028')
    mainframe.pack(side= TOP, ipadx= 5, ipady= 5)
 
    bouton_1 = HoverButton(A_Duplicate, font=("Arial", 10), text="Back", background='#1c2028', fg='white',  borderwidth=2, activebackground= '#202124', activeforeground='#1195cf', relief='ridge', command= main_menu)
    bouton_1.place(x=520, y=300)
 
    bouton_1 = Button(mainframe, font=("Arial", 15), text="Anti-Duplicate", background='#202124', fg='#1195cf',  borderwidth=2, activebackground= '#202124', activeforeground='#1195cf', relief='sunken')
    bouton_1.pack(padx= 5, pady=10, ipadx= 30)
 
 
#Fenêtre principale:
 
def main_menu():
    global main_menu
 
    main_screen = Tk()
    main_screen.resizable(width=False, height=False)
    screenn_x = int(main_screen.winfo_screenwidth())
    main_screen.config(background='#1c2028')
    screenn_y = int(main_screen.winfo_screenheight()) 
    main_screen.title("ComboKit v0.0.1")
    windowss_x = 570
    windowss_y = 340
 
    possX = (screenn_x // 2) - (windowss_x // 2)
    possY = (screenn_y // 2) - (windowss_y // 2)
 
    geoo = "{}x{}+{}+{}".format(windowss_x, windowss_y, possX, possY)
    main_screen.geometry(geoo)
 
    mainframe = Frame(main_screen, bg='#1c2028')
    mainframe.pack(side= TOP, ipadx= 5, ipady= 5)
 
    bouton_1 = HoverButton(mainframe, font=("Arial", 15), text="Fusion", background='#1c2028', fg='white',  borderwidth=2, activebackground= '#202124', activeforeground='#1195cf', relief='ridge')
    bouton_1.pack(side= LEFT, padx= 5, pady=5, ipadx= 30)
 
    bouton_2 = HoverButton(mainframe, font=("Arial", 15), text="Anti-Duplicate", background='#1c2028', fg='white',  borderwidth=2, activebackground= '#202124', activeforeground='#1195cf', relief='ridge')
    bouton_2.pack(side= LEFT, padx= 5, pady=5, ipadx= 30)
 
    bouton_3 = HoverButton(mainframe, font=("Arial", 15), text="Split*", background='#1c2028', fg='white',  borderwidth=2, activebackground= '#202124', activeforeground='#1195cf', relief='ridge')
    bouton_3.pack(side= LEFT, padx= 5, pady=5, ipadx= 30)
 
    main_screen.mainloop()
 
 
main_menu()

Merci beaucoup et bonne journée.