在这段代码中:
#! 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)
我有最后一个窗口的问题(easygui.msgbox(....),我想在不同行的单个窗口中显示所有信息,但我只能让它显示在一行上。
\n
和类似的东西不起作用。
这可能适用于"\n"
easygui.msgbox('\n'.join([
name,
hNumber,
street,
city,
country]))
我试过这个,你可以尝试我的固定版本。
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)
easygui.msgbox(name + "\n" + hNumber + "\n" + street + "\n" +
city + "\n" + country)
稍微长一点,但也可以。