Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 [Tkinter] Listbox and Button not showing
I am following a tutorial on YouTube. That person is using Python 3.7.2 and I am using 3.7.4. I am not getting the list box correctly portrayed and the buttons at the bottom of the GUI is not showing at all. I have went over the tutorial several times and cannot find where the problem lies. Here is the coding I have so far. I am getting a Listbox error but I don't see where in the tutorial this was defined. Thank you.

Traceback (most recent call last): File "C:\Users\pe\Documents\Python 3 Film Database\Python 3 Film Database\", line 121, in <module> application = Film(root) File "C:\Users\pe\Documents\Python 3 Film Database\Python 3 Film Database\", line 94, in __init__ filmlist = ListBox(DataFrameRIGHT, width=41, height=16, font=('arial', 12, 'bold'), yscrollcommand=scrollbar.set) NameError: name 'ListBox' is not defined

from tkinter import* 
import tkinter.messagebox
import filmDatabase_BackEnd

class Film:

    def __init__(self,root):
        self.root =root
        self.root.title("Classic Film Collection")
        self.root.config(bg="cadet blue")

        Title = StringVar()
        Year  = StringVar()
        Genre = StringVar()
        Actors = StringVar()
        Directors = StringVar()
        Summary = StringVar()
        Rating = StringVar()
        Length = StringVar()


        def iExit():
            iExit = tkinter.messagebox.askyesno("Classic Film Collection", "Confirm if you want to exit")
            if iExit > 0:

        def clearData():

        MainFrame = Frame(self.root, bg="cadet blue")

        TitFrame = Frame(MainFrame, bd=2, padx=54,pady=8, bg="Ghost White", relief=RIDGE)

        self.lblTit = Label(TitFrame, font=('arial', 47,'bold'), text="Classic Film Collection",bg="Ghost White")

        ButtonFrame =Frame(MainFrame, bd=2, width=1350, height=70, padx=18,pady=10, bg="Ghost White", relief=RIDGE)

        DataFrame =Frame(MainFrame, bd=1, width=1300, height=400, padx=20, pady=20, relief=RIDGE, bg="Cadet Blue")

        DataFrameLEFT =LabelFrame(DataFrame, bd=1, width=1000, height=600, padx=20, relief=RIDGE ,bg="Ghost White", font=('arial', 20, 'bold'), text="Film Information\n")

        DataFrameRIGHT =LabelFrame(DataFrame, bd=1, width=450, height=300, padx=31, pady=3, relief=RIDGE, bg="Ghost White", font=('arial', 20, 'bold'), text="Film Details\n")
        #========================================Labels and Entry Widget===============================
        self.lblTitle = Label(DataFrameLEFT, font=('arial', 20,'bold'),text="Title:", padx=2, pady=2, bg="Ghost White")
        self.lblTitle.grid(row=0, column=0, sticky=W)
        self.txtTitle = Entry(DataFrameLEFT, font=('arial', 20,'bold'),textvariable=Title, width=39)
        self.txtTitle.grid(row=0, column=1)

        self.lblyr = Label(DataFrameLEFT, font=('arial', 20, 'bold'),text="Year:", padx=2, pady=2, bg="Ghost White")
        self.lblyr.grid(row=1, column=0, sticky=W)
        self.txtyr = Entry(DataFrameLEFT, font=('arial', 20, 'bold'),textvariable=Year, width=39)
        self.txtyr.grid(row=1, column=1)

        self.lblact = Label(DataFrameLEFT, font=('arial', 20, 'bold'),text="Actors:", padx=2, pady=2, bg="Ghost White")
        self.lblact.grid(row=2, column=0, sticky=W)
        self.txtact = Entry(DataFrameLEFT, font=('arial', 20, 'bold'),textvariable=Actors, width=39)
        self.txtact.grid(row=2, column=1)

        self.lbldir = Label(DataFrameLEFT, font=('arial', 20, 'bold'),text="Directors:", padx=2, pady=2, bg="Ghost White")
        self.lbldir.grid(row=3, column=0, sticky=W)
        self.txtdir = Entry(DataFrameLEFT, font=('arial', 20, 'bold'),textvariable=Directors, width=39)
        self.txtdir.grid(row=3, column=1)

        self.lblgen = Label(DataFrameLEFT, font=('arial', 20, 'bold'),text="Genre:", padx=2, pady=2, bg="Ghost White")
        self.lblgen.grid(row=4, column=0, sticky=W)
        self.txtgen = Entry(DataFrameLEFT, font=('arial', 20, 'bold'),textvariable=Genre, width=39)
        self.txtgen.grid(row=4, column=1)

        self.lblsum = Label(DataFrameLEFT, font=('arial', 20, 'bold'),text="Summary:", padx=2, pady=2, bg="Ghost White")
        self.lblsum.grid(row=5, column=0, sticky=W)
        self.txtsum = Entry(DataFrameLEFT, font=('arial', 20, 'bold'),textvariable=Summary, width=39)
        self.txtsum.grid(row=5, column=1)

        self.lblrat = Label(DataFrameLEFT, font=('arial', 20, 'bold'),text="Rating:", padx=2, pady=2, bg="Ghost White")
        self.lblrat.grid(row=6, column=0, sticky=W)
        self.txtrat = Entry(DataFrameLEFT, font=('arial', 20, 'bold'),textvariable=Rating, width=39)
        self.txtrat.grid(row=6, column=1)
        #=================================================ListBox & ScrollBar Widget=======================================================
        scrollbar = Scrollbar(DataFrameRIGHT)
        scrollbar.grid(row=0, column=1, sticky='ns')

        filmlist = ListBox(DataFrameRIGHT, width=41, height=16, font=('arial', 12, 'bold'), yscrollcommand=scrollbar.set)
        filmlist.grid(row=0, column=0, padx=8)
        scrollbar.config(command = filmlist.yview)

        #================================================Button Widget ======================================================================
        self.btnAddData = Button(ButtonFrame, text="Add New", font=('arial', 20, 'bold'),height=1, width=10, bd=4)
        self.btnAddData.grid(row=0, column=0)
        self.btnDisplayData = Button(ButtonFrame, text="Display", font=('arial', 20, 'bold'),height=1, width=10, bd=4)
        self.btnDisplayData.grid(row=0, column=1)
        self.btnClearData = Button(ButtonFrame, text="Clear", font=('arial', 20, 'bold'),height=1, width=10, bd=4)
        self.btnClearData.grid(row=0, column=2)
        self.btnDeleteData = Button(ButtonFrame, text="Delete", font=('arial', 20, 'bold'),height=1, width=10, bd=4)
        self.btnDeleteData.grid(row=0, column=3)
        self.btnSearchData = Button(ButtonFrame, text="Search", font=('arial', 20, 'bold'),height=1, width=10, bd=4)
        self.btnSearchData.grid(row=0, column=4)
        self.btnUpdateData = Button(ButtonFrame, text="Update", font=('arial', 20, 'bold'),height=1, width=10, bd=4)
        self.btnUpdateData.grid(row=0, column=5)
        self.btnExit = Button(ButtonFrame, text="Exit", font=('arial', 20, 'bold'),height=1, width=10, bd=4, command=iExit)
        self.btnExit.grid(row=0, column=6)


if __name__=='__main__':
        root = Tk()
        application = Film(root)

error line numbers don't match listing
I don't see where you are ever calling filmlist once defined
Quote:NameError: name 'ListBox' is not defined
"ListBox doesn't exist, i.e. it's mis-spelled.

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  [PySimpleGui] How to alter mouse click button of a standard submit button? skyerosebud 3 289 Jul-21-2019, 06:02 PM
Last Post: FullOfHelp
  [Tkinter] Selected radio button in push button in Tkinter prashantfunde91 1 6,155 Jun-22-2017, 05:27 PM
Last Post: DeaD_EyE

Forum Jump:

Users browsing this thread: 1 Guest(s)