Skip to content
Advertisement

Tkinter – When adding “row=” to a Label in a for loop, items in list show up over each other

Sorry if the title is confusing I don’t really know how to word it properly. Hopefully the code below will clear it up.

When I run the program and I call print_names(), only the last name “Jenny” shows up.

While if I call the other two functions, all the items in the corresponding list show up.

However unless I add ‘row=’ then the different functions print on separate rows.

screenshot

I want to add row= so I can stop the different functions printing below each other, but if I add it, it causes only the last name to be printed.

How do I stop this from happening?

JavaScript

Advertisement

Answer

You can generate a string with all the names (or ages or genders) and then place this in the desired column and row. Here is an example:

JavaScript

The above will simply create a multi-line string and add it to column 0 and row 3.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement