[Tkinter] Trouble getting data from an entry. - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: [Tkinter] Trouble getting data from an entry. (/thread-32298.html) |
Trouble getting data from an entry. - Oshadha - Feb-02-2021 Code: from tkinter import * from pytube import YouTube from pytube import Playlist from pytube.cli import on_progress root = Tk() root.title('Masked YT Video Downloader') #functions def find_vid(url): return def check(url): if url.startswith('https://www.youtube.com/') or url.startswith('https://www.youtube.com/'): find_vid(url) else: error = Label(root, text = 'Please Enter a YouTube Url.') #Widgets name = Label(root, text = 'Masked YT Video Downloader', font = ("arial", 25, "bold"), fg = "Steel Blue", bd = 10).pack() by = Label(root, text = 'by hehehe', font = ("arial", 15, "bold"), fg = "#cc5c54", bd = 10).pack() enter_url = Label(root, text = 'Enter YouTube Url').pack() url_box = Entry(root, borderwidth = 4, width = 60).pack(pady = 5) find_btn = Button(root, text = 'Find', command = lambda : check(url_box.get())).pack() root.mainloop() Why does this happen!?
RE: Trouble getting data from an entry. - deanhystad - Feb-02-2021 Because url_box is None. RE: Trouble getting data from an entry. - steve_shambles - Feb-05-2021 I think the problem is the .pack integrated into one line, I've seen this before, can cause problems, try this line instead for the entry: url_box = Entry(root, borderwidth = 4, width = 60) url_box.pack() |