我安装了 PySimpleGUI 并将“Jump-Start”代码复制/粘贴到 vs 代码中。我试图运行它,它不断吐出错误
Exception has occurred: ModuleNotFoundError (note: full exception trace is shown but execution is paused at: <module>)
No module named '_tkinter'
File "/home/x/Code/PySimGui/testing_it_out.py", line 1, in <module> (Current frame)
import PySimpleGUI as sg
我已经使用安装了 tkinter
sudo apt-get install python-tk python3-tk tk-dev
...帮助
编辑:这是我的代码:
import PySimpleGUI as sg
sg.theme('DarkAmber') # Add a touch of color
# All the stuff inside your window.
layout = [ [sg.Text('Some text on Row 1')],
[sg.Text('Enter something on Row 2'), sg.InputText()],
[sg.Button('Ok'), sg.Button('Cancel')] ]
# Create the Window
window = sg.Window('Window Title', layout)
# Event Loop to process "events" and get the "values" of the inputs
while True:
event, values = window.read()
if event == sg.WIN_CLOSED or event == 'Cancel': # if user closes window or clicks cancel
break
print('You entered ', values[0])
window.close()