'Is there a way to make separate windows with each different count (1-10) in order to have those count?

from tkinter import *
from PIL import Image, ImageTk
import tkinter


def firstDicePage():
        #global opened, firstWindow

        firstWindow = tkinter.Toplevel(window)  # Create new window.

        firstWindow.title("Dice Roller Generator")

        # Change Icon photo
        image = PhotoImage(file = "C:\\Users\\alexi\\Desktop\\Project Photos\\Dice logo.png")
        firstWindow.iconphoto(False, image)

        # Center 
        app_width = 900
        app_height = 600


        screen_width = firstWindow.winfo_screenwidth()
        screen_height = firstWindow.winfo_screenheight()

        x = (screen_width / 2) - (app_width / 2)
        y= (screen_height / 2) - (app_height / 2)

        firstWindow.geometry(f'{app_width}x{app_height}+{int(x)}+{int(y)}')

        Label(firstWindow, text = "\n\nSelect How Many Dice You Want to Roll!", font='Helvetica 16 bold').pack()

        img = ImageTk.PhotoImage(Image.open("Dice.png"))
        my_label = Label(firstWindow, image=img)
        my_label.img = img  # Save reference to image.
        my_label.pack()

I used this method to create a number input, but how could I make it so that each number goes to its own window when clicking the "next" button. Would I have to use an if-else statement? Would it be easier to have one window with just a different number of images caused by the number you pick? An example would be putting three and there being three dice images. Would placing a submit button widget under the number input help?

        counter = tkinter.IntVar()

        def increase():
                counter.set(min(10, counter.get() + 1))

        def decrease():
                counter.set(max(0, counter.get() - 1))

        lbl = Label(firstWindow, textvariable = counter, font='Helvetica 16 bold')
        lbl.place(x=450, y=330)

        btn1 = Button(firstWindow, text="+", font='Helvetica 16 bold',  padx = 8, pady = 5, command = increase, fg="dark green", bg = "white")
        btn1.place(x=499, y=320)

        btn2 = Button(firstWindow, text ="-", font='Helvetica 16 bold', padx = 11.1, pady = 5, command = decrease, fg="dark green", bg = "white")
        btn2.place(x=375, y=320)

        btn3 = Button(firstWindow, text = "Back", font='Helvetica 16 bold', command = firstWindow.destroy)
        btn3.place(x = 30 , y = 530)

        btn4 = Button(firstWindow, text = "Next", font='Helvetica 16 bold', command=lambda: secondDicePage())
        btn4.place(x = 800 , y = 530)


def secondDicePage():

        secondWindow = tkinter.Toplevel(window)  # Create new window.

        secondWindow.title("Dice Roller Generator")

        # Change Icon photo
        image = PhotoImage(file = "C:\\Users\\alexi\\Desktop\\Project Photos\\Dice logo.png")
        secondWindow.iconphoto(False, image)

        # Center 
        app_width = 900
        app_height = 600

        screen_width = secondWindow.winfo_screenwidth()
        screen_height = secondWindow.winfo_screenheight()

        x = (screen_width / 2) - (app_width / 2)
        y= (screen_height / 2) - (app_height / 2)

        secondWindow.geometry(f'{app_width}x{app_height}+{int(x)}+{int(y)}')

        btn1 = Button(secondWindow, text = "Back", font='Helvetica 16 bold', command = secondWindow.destroy)
        btn1.place(x = 30 , y = 530)

        btn2 = Button(secondWindow, text = "Roll Dice", font='Helvetica 16 bold')


# Create the window(root inteface)
window = Tk()

# Create a title
window.title("Dice Roller Generator")

btn1 = Button(window, text = "Regular Dice", padx = 15, pady = 15, command = 
firstDicePage,).pack()


window.mainloop()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source