Python easygui模块
在此代码中:Python easygui模块,python,easygui,Python,Easygui,在此代码中: #! 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 =
#! 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”
稍长一点,但效果也不错。我试过这个,你可以试试我的固定版本
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
版本0.98.1
及其multenterbox
选项
所以你的代码应该是:
#! 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)
最好将它另存为
scriptname.pyw
而不是scriptname.py
我想你需要传递msgbox()
列表中的字符串,比如easygui.msgbox([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)
#! 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)