Add the attribute in existing elements in tkinter
<p>I'm trying to create the scrollbar in the Text widget. I search on google and have seen the existing SO questions but I'm not get the proper example.</p>

<pre><code>mycontainer = Text(root)
scrollbar = Scrollbar(mycontainer)
scrollbar.pack( side = RIGHT, fill=Y )

#here I want to add the attribute of yscrollcommand into the mycontainer

mycontainer = Text(yscrollcommand = scrollbar.set) #Not working 

for line in range(100):
   mycontainer.insert(END, "This is line number " + str(line))


mycontainer.place(x=5, y=40, width=500, height=500)
scrollbar.config( command = mycontainer.yview )
</code></pre>

<p>How can I do it properly?</p>