Skip to content
Advertisement

How can I condense this Python Tkinter GUI input code?

I’m taking part in Code in Place 2021 and for my final project I developed a Madlibs generator using Python and Tkinter, and the code is functional and works the way I want it to, but obviously it’s pretty long and convoluted. I was hoping some of you guys could offer some suggestions on how to make my code more concise and get rid of any unncessary lines!

I pasted all of the code below:

JavaScript

Advertisement

Answer

You can reduce your code to half if you use for loop and list.

Here is an example, you can modify the below code according to your need:

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