我编写了整个代码,唯一令我失望的是,我不能更改输入行和列,让我向您展示一下我的意思。
我不能在这里使用sg.output,因为它在抛出诸如**之类的特殊内容时会引发异常。
sg,Input 有没有办法改变的长度,或者其他什么方法,你最好通过看图片来了解。
发布于 2022-02-01 14:54:22
您可以使用类似于以下示例代码的MutiLine输入
[sg.Multiline('Many\nLines\n Here',size=(28,28),key='-MANY_LINES-'),],这样的完整代码
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)

https://stackoverflow.com/questions/70852390
复制相似问题