How to put scrollbar to a Label to scroll content inside a Text using Python Tkinter

Roj Lingo
Roj Lingo
4.7 هزار بار بازدید - 4 سال پیش - copy the code below:import tkinterfrom
copy the code below:

import tkinter
from tkinter import *
import docx
root = Tk()
file=docx.Document("put path of your file here")
array=[]
for i in file.paragraphs:            
       line=i.text
       array.append(line)
     
mylabel=Label(root)
mylabel.grid()
text=Text(mylabel)
text.grid(row=0,column=1)
scrollbar =Scrollbar(mylabel,command=text.yview)
text.config(yscrollcommand=scrollbar.set)
scrollbar.grid(row=0,column=0,sticky=NSEW)
text.insert(END,array)

root.mainloop()
4 سال پیش در تاریخ 1399/02/10 منتشر شده است.
4,718 بـار بازدید شده
... بیشتر