Skip to main content
 首页 » 编程设计

Python easygui 模块

2024年10月01日39langtianya

在这段代码中:

#! 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]))