how to read a txt file with scale python -
i trying read text file big , need scale that. using code
from tkinter import * tk = tk() tk.title("report") f = open("hola.txt", "r").read() label(tk, text=f).grid(row=0) w = scale(tk, from_=0, to=100) w.pack() tk.mainloop()
its not opening file showing me scale code opens file isnt scale
from tkinter import * tk = tk() tk.title("vulnerability report") f = open("hola.txt", "r").read() label(tk, text=f).grid(row=0) tk.mainloop()
i think, situation, if want read text file, better suited simple scrolllbar listbox.
from tkinter import * root = tk() scrollbar = scrollbar(root) scrollbar.pack(side=right, fill=y) listbox = listbox(root) listbox.pack() file = open('hola.txt', 'r').readlines() in file: listbox.insert(end, i) listbox.config(yscrollcommand=scrollbar.set) scrollbar.config(command=listbox.yview) mainloop()
if want edit, use other widget or more info, check http://effbot.org/zone/tkinter-scrollbar-patterns.htm
sorry, if misunderstood question.
Comments
Post a Comment