Ошибочную строку я пометил
import sys, pyowm
from PySide2 import QtCore, QtGui, QtWidgets
from des import Ui_Dialog
app = QtWidgets.QApplication(sys.argv)
Dialog = QtWidgets.QDialog()
ui = Ui_Dialog()
ui.setupUi(Dialog)
Dialog.show()
def get_weather_city():
owm = pyowm.OWM( '1b28fe5b2738c9d7561379ff8172e4f9' )
city = ui.lineEdit.text()
observation = owm.weather_at_place(city)
w = observation.get_weather() #ошибка тут
temperature = w.get_temperature('celsius')['temp']
ui.label.setText(f'Температура: {temperature}')
ui.pushButton.clicked.connect(get_weather_city)
sys.exit(app.exec_())
-
Вопрос задан
-
111 просмотров