Reputation: 51
In this code:
#! street.py
# A simple program which tests GUI
import easygui
easygui.msgbox("This programe asks for your info and stores them")
name = easygui.enterbox("What is your name?")
hNumber = easygui.enterbox("What is your house number")
street = easygui.enterbox("What is your post number?")
city = easygui.enterbox("What is your city?")
country = easygui.enterbox("What is your country?")
easygui.msgbox(name +
hNumber +
street +
city +
country)
I have problems with the last window(easygui.msgbox(....), I want to display all info in a single window at different lines but I can only get it to display on a single line.
\n
and similar doesn't work.
Upvotes: 2
Views: 1093
Reputation: 309
Use newest easygui
version 0.98.1
and it's multenterbox
option.
so your code would be:
#! street.pyw
# A simple program which tests GUI
import easygui
easygui.msgbox("This programe asks for your info and stores them")
info = easygui.multenterbox('Fill fields below','Info',['Name','Number','Street','City','Country'])
first = info[0]
second = info[1]
third = info[2]
fourth = info[3]
fiveth = info[4]
easygui.msgbox(first+'\n'+second+'\n'+third+'\n'+fourth+'\n'+fiveth)
And better save it as scriptname.pyw
not scriptname.py
.
Upvotes: 0
Reputation: 162
i tried this, you can try out my fixed version.
import easygui
easygui.msgbox("This programe asks for your info and stores them")
name = easygui.enterbox("What is your name?")
hNumber = easygui.enterbox("What is your house number")
street = easygui.enterbox("What is your post number?")
city = easygui.enterbox("What is your city?")
country = easygui.enterbox("What is your country?")
easygui.msgbox(name + '\n' + hNumber + '\n' + street + '\n' + city + '\n' + country)
Upvotes: 1
Reputation: 51
easygui.msgbox(name + "\n" + hNumber + "\n" + street + "\n" +
city + "\n" + country)
A bit longer but works as well.
Upvotes: 0
Reputation: 13317
This might work with "\n"
easygui.msgbox('\n'.join([
name,
hNumber,
street,
city,
country]))
Upvotes: 1