I'm just working on a GUI with tkinter in python. But I'm having some issues here. I'm creating a button that once it's clicked it will go back a page (Misc.lower(canvas2) and Misc.lift(canvas1)). Although i created a window for the button on the self.canvas2, the buttons is still there when the canvas is lowered.
Here is my code:
from tkinter import *
class Application:
    def __init__(self):
        self.window = Tk()
        self.window.geometry("1280x720")
        self.canvas1 = Canvas(self.window, highlightthickness=0, bg="#1b1b1b")
        self.canvas2 = Canvas(self.window, highlightthickness=0, bg="red2")
        self.initButtons()
        self.window.mainloop()
    def initButtons(self, *args):
        buttons = {}
        self.buttonList = []
        buttons['backButtons'] = Button(self.window, bd=0, activebackground="#1b1b1b", bg="#1b1b1b", text='Back', fg="#ffffff")
        self.buttonList.append(buttons['backButtons'])
        self.initSecondWindow()
    def initFirstWindow(self, *args):
        Misc.lower(self.canvas2)
        self.canvas1.place(relwidth=1, relheight=1)
    def initSecondWindow(self, *args):
        backButton = self.buttonList[0]
        backButton.config(command=self.initFirstWindow)
        self.canvas2.place(relwidth=1, relheight=1)
        self.canvas2.create_window(640, 360, window=backButton)
Application()
I read a bit about canvas.delete(), but I'm not sure how it works.
Thanks in advance!