我想做一个程序,告诉你一个与你选择的单词押韵的输入量。我是在PySimpleGUI中做的,我不知道如何将循环打印到PySimpleGUI窗口中。谁能帮帮我。预先感谢 -Josh
import PySimpleGUI as sg
import requests
layout = [[sg.Text('What would you like to hear rhymes about: '), sg.InputText()],
[sg.Submit(), sg.Cancel()]]
window = sg.Window('Rhyme.', layout)
event, values = window.read()
rhyme = values[0]
words = requests.get('https://api.datamuse.com/words?rel_rhy=' + rhyme)
words_json = words.json()
window.close()
layout = [[sg.Text(f'How many rhymes about {rhyme} would you like to hear: '), sg.InputText()],
[sg.Submit(), sg.Cancel()]]
window = sg.Window('Rhyme.', layout)
event, values = window.read()
num = values[0]
window.close()
layout = [[sg.Text(#I dont Know how to print the list here)