-1

I am creating a billing software using TKinter module. I m facing a problem of unknown options. I m adding a scroll bar to Frame2 because I want to add multiple items an such error take place.. if anyone can help me out...??

    from tkinter import*
    from tkinter import messagebox,ttk
    import math,random,os
    class Bill:
        def __init__(self,root):
            self.root = root
            self.root.geometry("1350x700+0+0")
            self.root.title("Billing Software") 
            bg_color = "#074463"
            title = Label(self.root,text="BILLINGSOFTWARE",bd=12,relief=GROOVE,
            bg=bg_color,fg="white",font=("times new roman",30,"bold"))
            title.grid(ipadx=463)
            F2= Frame(self.root,relief=GROOVE,bd=10,bg=bg_color)
            F2.place(x=5,y=180,width=864,height=380)
            scroll_y = Scrollbar(F2,orient=VERTICAL)
            self.fr = Frame(F2,yscrollcommand=scroll_y.set) 
            scroll_y.grid(row=5,column=0,padx=10,pady=50)          
            scroll_y.config(command=self.fr.yview)
            self.fr.grid(row=1,column=2,padx=10,pady=10)                
    
          
            it1_lbl=Label(F2,text="item1",font=("times new 
             roman",16,"bold"),bg=bg_color,fg="lightgreen")
            it1_lbl.grid(row=0,column=0,padx=10,pady=10,sticky="w")
            cmb_quest1 = ttk.Combobox(F2,font=("Times new 
            roman",12),state="readonly",justify="center",width=5)
            cmb_quest1['values'] = ("0","1","2")
            cmb_quest1.grid(column=1,padx=10,pady=0,row=0)
            cmb_quest1.current(0)
            it1_lbl_txt = Entry(F2,width=3,font=("Times new 
            roman",15,"bold"),bd=5,relief=SUNKEN,justify="center") #textvariable=self.it1,
            it1_lbl_txt.grid(row=0,column=2,padx=10,pady=10)
    
          
    root = Tk()
    obj = Bill(root)
    root.mainloop()

``````````

---Error---
  Traceback (most recent call last):
  File "d:\Billing Software\temp.py", line 73, in <module>
    obj = Bill(root)
  File "d:\Billing Software\temp.py", line 46, in __init__
    self.fr = Frame(F2,yscrollcommand=scroll_y.set) 
  File "C:\Python\Python38\lib\tkinter\__init__.py", line 3119, in __init__
    Widget.__init__(self, master, 'frame', cnf, {}, extra)
  File "C:\Python\Python38\lib\tkinter\__init__.py", line 2567, in __init__
    self.tk.call(
  _tkinter.TclError: unknown option "-yscrollcommand"
  • Frames aren't scrollable. If you read the documentation for the Frame widget you'll see that it confirms the error message: frames don' t have a `yscrollcommand` option. – Bryan Oakley Oct 01 '20 at 14:01

1 Answers1

2

Unfortunately, we can't add scrollbars to frame in Tkinter we have to use canvas for that

Refer this: tkinter: using scrollbars on a canvas

Rahul A Ranger
  • 496
  • 1
  • 5
  • 13