Search code examples
pythoneasygui

EasyGUI- Integerbox Output


I just started learning Python, and after messing around and creating a program I wanted to use, I wanted to create a GUI for it. I had no idea how to start with it, so I just looked it up and found EasyGUI.

I have it working and everything, but how do I record the answer into a variable?

import easygui as eg
n=0
eg.integerbox(msg="What is the max integer in the Sequence, n?"
              , title="blah blah blah"
              , default=0
              , lowerbound=0)

I want to set the answer to the question, What is the max integer in the Sequence, n? as a variable (for this instance, n).

Like n=output or something, but there is no 'output' syntax.

Any ideas on how to do so?


Solution

  • Not an expert on easygui, but I'll give it a stab.

    Have you tried something like:

    import easygui as eg
    uservalue = eg.integerbox(msg="What is the max integer in the sequence, n?"
                      , title = "blah blah blah"
                      , default = 0
                      , lowerbound = 0
    

    The easygui documentation gives a similar example for choicebox:

    msg ="What is your favorite flavor?"
    title = "Ice Cream Survey"
    choices = ["Vanilla", "Chocolate", "Strawberry", "Rocky Road"]
    choice = choicebox(msg, title, choices)