Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7555239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:33:18+00:00 2026-05-30T11:33:18+00:00

I mean I’ve set up a choicebox. msg = What would you like to

  • 0

I mean I’ve set up a choicebox.

    msg = "What would you like to do first?"
title = "Economy v1.0"
choices = ["Check your bank balance", 
           "Check the value of the stocks", 
           "Check what stocks you own", 
           "Buy stocks", 
           "Sell Stocks", 
           "Move to the next day.", 
           "Exit"]
choice = eg.choicebox(msg, title, choices)

But now I’d like to know how I get it to do something when a choice is selected. The tutorial on the website didn’t give much help, and all the things I’ve experimented with haven’t worked.

I tried to do this first:

if choice == choice[0]:
    #do stuff
if choice == choice[1]:
    #do more stuff
...

When I selected a choice, nothing happened.

So then I tried this:

if choice == "Buy Stocks":
    #do stuff
if choice == "Sell Stocks":
    #do stuff
...

But that didn’t work either.
I have tried a range of other things, but I’m not entirely sure what the choicebox returns, and what variable it stores it in. Could someone help me out here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T11:33:19+00:00Added an answer on May 30, 2026 at 11:33 am

    What you’re doing should be working. Either of those if statements should be fine, just remember that strings are case sensitive.

    The easygui.choicesbox() is going to return a string to the variable you assign it to. In this case, it will ask for a selection, then stuff that value you selected into your variable choice. Remember that choicesbox always returns a string.

    if you try choice in choices it should return True.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I mean if I check first clients input and it is OK the second
I mean can I do something like this: var client = new WebClient(); var
I mean, using css sprites on non static content like: Inside while(mysql_fetch_array())...
I mean, for pixel position, sizes, etc. It's not like I'll be making a
I mean: Are there any things I can't implement in an abstract class? Like:
I mean,, that would be the only issue to worry about when using silverlight
I mean... I set it to NULL . So isset($somethingNULL) == true ?
I mean WndProc_OnCommand(HWND hWnd, int id, HWND hwndCtl, UINT codeNotify) can be rewrited like
I mean the reverse of this function: styleObj = window.getComputedStyle(node); So something like this:
I mean settings that can be changed from task manager like realtime or idle.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.