0

how can i open Frame7 without having to open myFrame4 first, when i dont open myFrame4 first i get an Attribute error however when i open myFrame4 first and then go back to open Frame7 it opens, i know this is happening because myFrame4 is being pack_forget() without even being opened and actually being an object but i just dont know how to fix it. (intention is to run def cart_order(self): from the home page but can only do so by running def order_menu(self): first then going back to home page and then run it). hopefully i made sense.

def openMenu(self):

    for wid in root.winfo_children():
        wid.destroy()
    self.myFrame.destroy()

    self.myFrame2 = Frame(root)
    self.myFrame2.pack(fill = "both", expand = 1)


    self.img77 = PhotoImage(file = 'new-dip-project\\goode.png')
    self.name77 = Label(self.myFrame2, image = self.img77).pack()

    self.img_menu = PhotoImage(file = 'new-dip-project\\menu_button.png')
    self.b6 = Button(self.myFrame2,image = self.img_menu, command = self.view_menu, bd  = 0)
    self.b6.place(x = 246, y = 140)

    self.img_order = PhotoImage(file = 'new-dip-project\\order_button.png')
    self.b7 = Button(self.myFrame2,image = self.img_order, command = self.order_menu, bd  = 0)
    self.b7.place(x = 239, y = 228)

    self.img_checkout = PhotoImage(file = 'new-dip-project\\checkout.png')
    self.b8 = Button(self.myFrame2,image = self.img_checkout, bd  = 0, command = self.cart_order)
    self.b8.place(x = 250, y = 316)




def cart_order(self):


    self.myFrame4.pack_forget()
    self.myFrame2.pack_forget()
    self.Frame7 = Frame(root)
    self.Frame7.pack(fill = "both", expand = 1)




    def order_menu(self):

    self.myFrame2.destroy()
    self.myFrame4 = Frame(root)
    self.myFrame4.pack(fill = "both", expand = 1)

    self.back_img = PhotoImage(file = 'new-dip-project\\bbutton.png')
    self.back_btn2 = Button(self.myFrame4, image = self.back_img, bd = 0, command = self.openMenu)
    self.back_btn2.place(x = 50, y = 410)
chepner
  • 497,756
  • 71
  • 530
  • 681
no one
  • 1
  • 1

0 Answers0