I want to write a small program that displays auto-scrolling news ticker text from left to right (with Tkinter?),or at least some GUI.
The text should come from a text .txt file.
I am still a beginner in Python and can't really grasp how to do this? Like how to control the timings from each line to show up etc?
Would a loop calling each line be the right way to do this?
Or how would you approach this? All help/links will be very appreciated
Here's a program using Tkinter to scroll text in a box. See 1 and 2 regarding options for label()
; see 3 about the after()
method.
import Tkinter as tk
root = tk.Tk()
deli = 100 # milliseconds of delay per character
svar = tk.StringVar()
labl = tk.Label(root, textvariable=svar, height=10 )
def shif():
shif.msg = shif.msg[1:] + shif.msg[0]
svar.set(shif.msg)
root.after(deli, shif)
shif.msg = ' Is this an alert, or what? '
shif()
labl.pack()
root.mainloop()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With