2

I wrote the whole code the only thing disappointing me is that I can't change the input rows and column let me show you what I mean by this.

I want this kind of dialog box, check this image

Instead I get this one

I can't use the sg.output here because it raises exception when throwing something special like ** in it

Is there any way to change the length of sg,Input or any alternative you better get an idea by seeing images.

  • IMO, you may use wrong element `sg.Input` for it, should be `sg.Multiline`. The height of `sg.Input` is always 1. – Jason Yang Jan 25 '22 at 17:27

1 Answers1

2

You can use a MutiLine input like this sample code

[sg.Multiline('Many\nLines\n Here',size=(28,28),key='-MANY_LINES-'),],

Full code like so

 txt2=""
#Initialize a holder variable 
fruits=['apple', 'orange', 'pears', 'tomatoes']

#Convert from List to Text with New line
for i in fruits:txt2=f"{fruits}{i}\n"

#Create layout
layout2 = [[sg.Multiline(txt2,size=(28,28),key='-Items-'),],[sg.Ok()] ]

#Single shot Popup Window
sg.Window('Scroll to see the whole list of fruits', layout2,finalize=True).read(close=True)

Example of PySimpleGUI Popup with Many lines of output and Scrolling of text.

kephalian
  • 84
  • 6