On 2020-12-05 18:56, Paulo da Silva wrote:
Hi!
Why this example does not work?
There are a few bits of configuration missing:
------------------
from tkinter import *
root=Tk()
root.geometry("400x200")
Add:
root.grid_rowconfigure(0, weight=1)
root.grid_columnconfigure(0, weight=1)
root.grid_columnconfigure(1, weight=0)
S=Scrollbar(root)
T=Text(root)
T.grid(row=0,column=0)
S.grid(row=0,column=1)
Change to:
T.grid(row=0, column=0, sticky=NSEW)
S.grid(row=0, column=1, sticky=NS)
S.config(command=T.yview)
T.config(yscrollcommand=S.set)
txt="""This is a very big text
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Last line
"""
T.insert(END,txt)
mainloop()
---------------------
[snip]
--
https://mail.python.org/mailman/listinfo/python-list