AttributeError: 'Frame' object has no attribute 'yview'
Проблема наверное состоит в том, что yview не принимает виджеты Frame по каким то причинам.Скажите, что я неправильно делаю, и как это скорректировать.
new_root = tk.Toplevel(root, bg='white')
new_root.minsize(width=1800, height=2000)
new_root_title = tk.Label(new_root, text="Спорт", font="Colibri 50")
new_root_title.place(x=30, y=50)
# frame в котором будут отображаться спарсенные данные
champ_news = tk.Frame(new_root, width=135, height=180)
# парсинг сайта
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.185 YaBrowser/20.11.2.78 Yowser/2.5 Safari/537.36'}
try: # обработка возможных ошибок
responce = requests.get(championat, headers=headers)
soup = BeautifulSoup(responce.content, 'html.parser')
items = soup.findAll('div', class_='news-item__content')
comps = []
for item in items:
comps.append({'title': item.find('a', class_='news-item__title').get_text(
strip=True), 'link': item.find('a', class_='news-item__title').get('href')})
champ_title = tk.Label(champ_news, text='Чемпионат', font='Colibri 19')
champ_title.pack()
for comp in comps:
print(comp['title'])
text_for_btn = comp['title']
btn = tk.Button(
champ_news, bg='white', text=text_for_btn, font='Colibri 13')
btn.pack(side='top', padx=2, pady=3)
print('===========================')
except requests.exceptions.ConnectionError:
notification_text = 'Отсутствует интернет соединеие :( Увы,но без него отобразить свежые новости и статьи не получится'
notification_about_error = tk.Label(
new_root, text=notification_text, font='Colibri 30')
notification_about_error.place(x=30, y=360)
else:
champ_news.place(x=7, y=315)
scroll = tk.Scrollbar(new_root,command=champ_news.yview)
champ_news.configure(yscrollcommand=scroll.set)
scroll.pack(side='right',sticky='ns')