Единственное решение, которое я нахожу сейчас, используя встроенную ссылку на YouTube, это следующее:
Код: Выделить всё
import customtkinter
from tkinterweb import HtmlFrame # Import HtmlFrame to use the embedded browser
import pytube
from pytube import extract
class App(customtkinter.CTk):
def __init__(self):
super().__init__()
self.visualisation_frame = customtkinter.CTkFrame(self)
self.visualisation_frame.pack(pady=20, padx=20)
self.youtubeframe = HtmlFrame(self.visualisation_frame) # Use HtmlFrame to display the YouTube video
self.youtubeframe.grid(row=0, column=0, columnspan=2, padx=20, pady=(20, 5))
# def update_url(self, url):
video_embed_url = "https://www.youtube.com/embed/6Ejga4kJUts"
self.youtubeframe.load_website(video_embed_url) # Update to load the embedded video
if __name__ == "__main__":
app = App()
app.mainloop()
Произошла ошибка.Невозможно выполнить JavaScript.
У вас есть какое-нибудь решение этой задачи?
Спасибо.
Подробнее здесь: https://stackoverflow.com/questions/786 ... in-tkinter