PysimpleGUI Message Box

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.

Upvotes: 2

Views: 1629

Answers (1)

kephalian
kephalian

Reputation: 84

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.

Upvotes: 2

Related Questions