0
good morning,
I was creating a graphical interface with python and for that I used Tkinter and I was trying to create a scrollbar inside my project but it does not recognize the command to connect to scroolbar the existing labels (follow the example):
from tkinter import *
class JanelaPrincipal(Frame):
def __init__(self,master):
Frame.__init__(self,master)
self.master.title('Avocado')
self.master.geometry('800x600')
self.configure(height=200,width=200)
#scroll bar
self.scroll=Scrollbar(master)
self.scroll.pack(side=RIGHT, fill="y")
self.batata=Label(self.master,width="800",height="10",text="Algum texto",relief="raise",yscrollcommand=self.scroll.set)
self.batata.pack(expand=0, fill=BOTH, side=TOP)
root=Tk()
app=JanelaPrincipal(root)
root.mainloop()
The error that returns is:
Traceback (most recent call last):
File "pap.py", line 16, in <module>
app=JanelaPrincipal(root)
File "pap.py", line 12, in __init__
self.batata=Label(self.master,width="800",height="10",text="Algum texto",relief="raise",yscrollcommand=self.scroll.set)
File "/usr/lib/python3.6/tkinter/__init__.py", line 2766, in __init__
Widget.__init__(self, master, 'label', cnf, kw)
File "/usr/lib/python3.6/tkinter/__init__.py", line 2299, in __init__
(widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError: unknown option "-yscrollcommand"
I’ve done enough research but everyone uses that argument and when I try to use the error interpreter, if anyone can help