Default input

Sometimes when a user is entering information, there is a certain answer that is expected, common, or most likely to be entered. That is called a default. You might be able to save the user some typing by automatically entering the most common answer for her. Then, she'd only have to type an answer if she had a different input.

To put a default in an enter box, change your program to look like the one in listing 6.4.

Listing 6.4 How to make default arguments

import easygui

flavor = easygui

.enterbox("What is your favorite

ice cream flavor?",

default = 'Vanilla')

__Here's the

easygui.msgbox ("

You entered " + flavor)


Now, when you run it, "Vanilla" is already entered in the enter box. You can delete it and enter anything you want, but if your favorite flavor is vanilla, you don't have to type anything, just click OK.

Was this article helpful?

+1 0
100 Bowling Tips

100 Bowling Tips

Playing bowling with your friends can help you decide if it is indeed the hobby that you want to invest your time on today. Aside from that, it can help you get a better feel of the sport. More importantly, when you play with your friends, it would become a more fun activity, which you can look forward to each week.

Get My Free Ebook

Post a comment