-1

Is it possible to make and use a number of input boxes in a tkinter program, based on user input; e.g. I run the program, I tell the program I need 6 inputs, and it creates 6 input boxes for me to then use for my data? If my program tracked clothes, I could have 3 pieces of clothes on, or 6, and then after I say how many I have on, I can then input the individual items; "Shirt", "Jumper", "Socks" into each box.

1 Answers1

0

It is possible.

Here in an example using buttons:

from Tkinter import *

class SampleApp(Tk):

    def __init__(self, s):

        Tk.__init__(self)
        self.title("GUI")
        x = 200
        y = s*30
        self.geometry(str(x) + "x" + str(y))

        for i in range(1, s+1):

            self.button = Button(self, text="Button " + str(i))
            self.button.pack()

app = SampleApp(5)
app.mainloop()