I have a Python application that builds itself using a JSON file, for customization purposes. But, I realized that I have no way of dealing with overflow, and now that it has a lot of stuff it either overflows to the sides or to the bottom.
This is the code that works for small amounts of widgets, but can’t adapt.
def BuildApplication():
for key in jsonValueDict:
key = ttk.Label(topContainer, text="Insira a coluna " + jsonValueDict[key])
key.pack()
for key in jsonInputDict:
key = ttk.Entry(topContainer)
key.pack()
btnSubmit = ttk.Button(midContainer, text="Finalizar", command=Submit)
btnSubmit.pack()
btnExport = ttk.Button(midContainer, text="Exportar", command=Export)
btnExport.pack()
print("Finished loading.")
I saw some people talking about using “for x in range” loops but I can’t since it’s based on a dictionary and it can have multiple sizes. I tried using modulus to change it every x amount of widgets, but since I have a label and an input it doesn’t work.
I tried using ‘counter’ variables that increased during iteration, but it either just created a downward stair or just completely messed up the buttons.
I need this to become a grid, “after x amount of widgets, move to the side and start counting again”