Join Club ShowMeDo to Learn Python!

This series is a part of Club ShowMeDo. Click to learn why you should join our club with a simple monthly subscription.

  • We teach Python and all the cool modules
  • Topics include beginner Python, GUIs, Web and Desktop Apps
  • Long, specially crafted video tutorials just for you
  • Club video tutorials extend our normal Free content
  • Save your time - we've done the research for you
  • Keep your skills up-to-date
  • Learn at your own pace, everything you need is shown to you
  • Over 12 hours of archived material are waiting for you in the club

Name: [002] Ian Ozsvald
Member: 128 months
Authored: 181 videos
Description: I am the co-founder of ShowMeDo (see, author of `The Screencasting Handbook <>`_ and the founder of the professional screencast production company `ProCasts <>`_: .. image:: ...

Exercise: User Interaction with a Yes/No control and the EnterBox [ID:247] (6/17)

in series: Python 101 - easygui and csv

(Showmedo is undergoing major changes. To report any problems viewing the videos please email us and include browser and OS specifics. Cheers - Kyran.)

Want to question the user with a dialog? Want to ask for text input? Learn how to do both in this episode, this is a digression from the main theme aimed at teaching you more about easygui's wide selection of user-interface controls.

You'll learn about asking the user for input and also you'll have to think for a moment to write some Python logic.

Created May 2007, running time 4 minutes

# TODO you will need to import easygui first

# use easygui's enterbox to ask for the name from the user
# TODO complete the enterbox line with a statement
# such as 'Please enter your name'

# use easygui's yes/no box to ask a Yes/No question
yesNo = easygui.ynbox(message = "Is "+name+" your name?")

# if "Yes" then we print the name back out
# with easygui a 'Yes' answer is represented as an Integer 1
# which is equivalent to True for Boolean logic
if yesNo == 1: # if 1 then this statement becomes True
    print "Yes "+name+" is your name"
# if you press No then print another message
# TODO if "No" then show something 
# like "You didn't enter your name, you silly-billy!"
# TIP Just as 1 is True, a 0 represents False
# so you can copy the section of code above and make
# one logic change and rewrite the print message

Got any questions?

Get answers in the ShowMeDo Learners Google Group.

Video statistics:

  • Video's rank shown in the most popular listing
  • Video plays: 2 (since July 30th)
  • Plays in last week: 0
  • Published: 111 months ago

Thank-yous, questions and comments

If this video tutorial was helpful please take some time to say thank-you to the authors for their hard work. Feel free to ask questions. Let the author know why their video tutorial was useful - what are you learning about? Did the video tutorial save you time? Would you like to see more?

You may also want to see our ShowMeDo Google Group to speak to our active users and authors.

Your email address will not be published.

Show some quick comments >>

All comments excluding tick-boxed quick-comments

Using "Wing IDE" under "Exceptions", I don't have the option to "Ignore this exception", it's grayed out. Is that because I am using a trial version? Thor

The syntax for EasyGui version 0.93 uses argument 'msg' rather than 'message' in ynbox()

9. anonymous Mon, 30 Nov 2009 12:54


Thanks for the Podcast, and especially, for the exercises! Keep those coming! While screencasts are great to see a real demonstration of the concept at work, exercises are great for applying knowledge right away, and being sure that you've absorbed everything.

Again, thanks!

Exercise: User Interaction with a Yes/No control and the EnterBox (6/17)

0:00 Enter Box (for entry of a name)

0:30 Yes/No Box

1:20 == 1 or 0 to test value of yesNo


NOTE: You DO NOT want

Review of Exercise: User Interaction with a Yes/No control and the EnterBox

In the source code, the argument to ynbox: (message = "Is "+name+" your name?") - did not work for me8-(

When I changed 'message' to 'msg' as per the function definition it worked!

Nice way to work in the docs!!! It took me a second to see what was going on.

So far you've got my vote when it comes to teaching style. Best I've run across yet. Thank you very much for putting these together.

This didn't work for me until i realised i had copied the line numbers into wing ide,as soon as i got rid of them everything worked fine :)

At first glance, this code was a little confusing:

message = "Is "+name+" your name?"

I didn't realize that the right-hand side was an expression: string + variable + string. Rather, I thought that ...


... was some Perl-like (or newfangled-Python-template-like) mechanism for embedding a variable reference in a string. So I'd suggest adding some SPACE chars:

message = "Is " + name + " your name?"

Or maybe use a formatted string:

message = "Is %s your name?" % name

Great challenge, my code worked...barely.

Such a good-looking source-code feature...

I wonder if a third tab for better integration with the wiki pages of a video is possible ?

Showmedo is a peer-produced video-tutorials and screencasts site for free and open-source software (FOSS)- with the exception of some club videos, the large majority are free to watch and download.

how to help » about » faq »

Educating the Open-source Community With Showmedo

Although as important as the software it supports, education and documentation are relatively neglected in the Open-source world. Coders love to code, and explaining how best to use or improve the software tends to be deferred or even sidelined.

At Showmedo we believe the community can play a vital role here and also say thanks for the tools and software that make our lives easier. If you have a piece of software you love or a programming langugage you are enthusiastic about, why not make a screencast showing others how to use it? All the stuff you wish you'd been told, the tips, tricks, insights that would have saved you time and frustration.

Screencasting is easier than you think, and we're happy to help you. You can emailus for advice or just use some of the how-to screencasts on the site. This screencasting learning-pathis a good place to start.

Kudos and Thanks for Ian

3 Minute Oveview (What Does Python Look Like?)

simple and informative. you draw me in
70 months ago


Showmedo's development is fairly rapid and bugs will inevitably creep in. If you have any problems please drop us a line using the contact address below. Likewise, any suggestions for improvements to the site are gratefully received.