Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

Python Need help with my code for a tkinter gui youtube downloader - AttributeError: 'int' object has no attribute 'cget'

Felixcode

New Coder
First things first, Im german (strings in german aswell) and a bloody beginner when it comes to coding, but its fun and I want to improve.
This code worked perfectly fine until a changed something that made this error appear: AttributeError: 'int' object has no attribute 'cget'
The cget attribute worked fine and I dont know what I changed to make it occure.
Ive already tried things like changing the name of variables in order to avoid spelling interferences.

Maybe someone can help me fix this problem as im clueless what to do.

Heres the code:

Python:
from tkinter import *
from tkinter import filedialog
from tkinter import font
from moviepy import *
from moviepy.video.io.VideoFileClip import VideoFileClip
from pytube import YouTube
from tkinter import ttk
from tkinter import *
from tkinter.ttk import *
import shutil

 
# functions
def select_path():
        path = filedialog.askdirectory()
        path_text.config(text=path)
def download_video():
    get_link = url_entry.get()
    user_path = path_text.cget("text")
    screen.title("Lädt herunter...")
    mp4_video= YouTube(get_link).streams.get_highest_resolution().download()
    clip = VideoFileClip(mp4_video)
    clip.close()
    shutil.move(mp4_video, user_path)
    screen.title("Download abgeschlossen!")
# head
screen = Tk()
icon = screen.iconbitmap(r'c:\Users\feera\OneDrive\Desktop\Codes\p3\et_logo.ico')
title = screen.title("EvilTube Downloader")
fonts = list(font.families())
fonts.sort()
screen.resizable(False, False)
# create canvas
canvas = Canvas(screen, width=500, height=500, bd=0, highlightthickness=0, relief='ridge')
canvas.pack(fill="both", expand=True)
# bg image
og_bg_img = PhotoImage(file=r"C:/Users/feera/OneDrive/Desktop/Codes/p3/images/bg_texture.png")
# bg position
dp_bg_img = og_bg_img.subsample(1,1)
canvas.create_image(0, 0, anchor=NW, image=dp_bg_img)
# ETD Logo
ETD_logo_img = PhotoImage(file=r"C:/Users/feera/OneDrive/Desktop/Codes/p3/images/et_full_logo.png")
# ETD Logo position
logo_img = ETD_logo_img.subsample(5,5)
canvas.create_image(250, 120, image=logo_img)
# flames
og_flames_img = PhotoImage(file=r"C:/Users/feera/OneDrive/Desktop/Codes/p3/images/flames.png")
# flames position
dp_flames_img = og_flames_img.subsample(3,3)
canvas.create_image(0, 280, anchor=NW, image=dp_flames_img)
# url input
url_entry = Entry(screen, width=60)
# add url input
canvas.create_text(250, 240, text="URL einfügen: ", font=("Agency FB", 17), fill="white")
canvas.create_window(250, 280, window=url_entry)
# select filepath
select_path_button = Button(screen, text="Speicherort auswählen", command=select_path)
# add select filepath
path_text = canvas.create_text(250, 330, text="Wähle einen Speicherort", font=("Agency FB", 16), fill="white")
canvas.create_window(250, 375, window=select_path_button)
# download button
download_button = Button(screen, text="Video herunterladen", command=download_video)
# add download button
canvas.create_window(250, 430, window=download_button)
screen.mainloop()
 
Last edited by a moderator:

Buy us a coffee!

Back
Top Bottom