首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Python easygui模块

Python easygui模块
EN

Stack Overflow用户
提问于 2017-07-24 02:53:39
回答 4查看 608关注 0票数 2

在此代码中:

代码语言:javascript
复制
#! 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和类似的东西不起作用。

EN

回答 4

Stack Overflow用户

发布于 2017-07-24 02:57:21

这可能适用于"\n"

代码语言:javascript
复制
easygui.msgbox('\n'.join([
               name,
               hNumber,
               street,
               city,
               country]))
票数 1
EN

Stack Overflow用户

发布于 2018-03-01 11:16:00

我试过了,你可以试试我的修复版本。

代码语言:javascript
复制
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)
票数 1
EN

Stack Overflow用户

发布于 2017-07-24 03:21:02

代码语言:javascript
复制
easygui.msgbox(name + "\n" + hNumber + "\n" + street + "\n" +
               city + "\n" + country)

稍长一点,但也同样有效。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45268785

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档