Using the method here Switch between two frames in tkinter I want to stack the same frame 10 times to create a 10 question quiz, so far i have made this work by copying and pasting the frame 10 times and changing the name, however i am hoping there is an easier more efficient way to do this using some sort of loop. I have included a extract of the code below, thanks for any help.
from tkinter import *
class secondaryActivity(Tk):
    def __init__(self, *args, **kwargs):
        Tk.__init__(self,*args,**kwargs)
        container=Frame(self)
        container.pack(side="top", fill="both", expand=True)
        container.grid_rowconfigure(0, weight=1)
        container.grid_columnconfigure(0, weight=1)
        self.frames={}
        for F in (quiz, quiz1):
            frame = F(container, self)
            pageName = F.__name__
            self.frames[pageName]=frame
            frame.grid(row=0, column=0, sticky="snew")
        self.showFrame("quiz")
    def showFrame(self, pageName):
        frame=self.frames[pageName]
        frame.tkraise()
class quiz(Frame):
    def __init__(self, parent, controller):
        Frame.__init__(self, parent)
        self.controller=controller
        self.label1= Label(self, text="this is quiz")
        self.label1.pack()
        self.submitBtn = Button(self, text="submit", command=self.submitBtnClicked)
        self.submitBtn.pack()
    def submitBtnClicked(self):
        self.controller.showFrame("quiz1")
class quiz1(Frame):
    def __init__(self, parent, controller):
        Frame.__init__(self, parent)
        self.controller=controller
        self.label1= Label(self, text="this is quiz1")
        self.label1.pack()
        self.submitBtn = Button(self, text="submit", command=self.submitBtnClicked)
        self.submitBtn.pack()
    def submitBtnClicked(self):
       self.controller.showFrame("quiz")
app = secondaryActivity()
app.mainloop()