Python easygui modu

2024-10-02 00:27:40 发布

您现在位置:Python中文网/ 问答频道 /正文

在本规范中:

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

最后一个窗口有问题(易趣.msgbox(…..),我希望在一个窗口中以不同的行显示所有信息,但只能在单行上显示。
\n和类似的不起作用。在


Tags: namepy规范streetnumbercityyouris
3条回答

这可能适用于"\n"

easygui.msgbox('\n'.join([
               name,
               hNumber,
               street,
               city,
               country]))
easygui.msgbox(name + "\n" + hNumber + "\n" + street + "\n" +
               city + "\n" + 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)

相关问题 更多 >

    热门问题