2

In this code:

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

I have problems with the last window(easygui.msgbox(....), I want to display all info in a single window at different lines but I can only get it to display on a single line.
\n and similar doesn't work.

boardrider
  • 5,882
  • 7
  • 49
  • 86
Alex
  • 51
  • 1
  • 7
  • I think you need to pass `msgbox()` the strings in a list, like `easygui.msgbox([name, hNumber, street, city, country])`. – martineau Jul 23 '17 at 19:18

4 Answers4

1

This might work with "\n"

easygui.msgbox('\n'.join([
               name,
               hNumber,
               street,
               city,
               country]))
PRMoureu
  • 12,817
  • 6
  • 38
  • 48
1

i tried this, you can try out my fixed version.

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)
Haoyang Song
  • 162
  • 12
0
easygui.msgbox(name + "\n" + hNumber + "\n" + street + "\n" +
               city + "\n" + country)

A bit longer but works as well.

Alex
  • 51
  • 1
  • 7
0

Use newest easygui version 0.98.1 and it's multenterbox option.

so your code would be:

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

And better save it as scriptname.pyw not scriptname.py.

UltraStudioLTD
  • 300
  • 2
  • 14