Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_text_ani.py
- import Tkinter as tki
- def scroll_text(s, how_many):
- return s[how_many:] + s[:how_many]
- direction = 1
- tk = tki.Tk()
- var = tki.Variable(tk)
- def mouse_handler(point):
- global direction
- direction *= -1
- def timer_handler():
- var.set(scroll_text(var.get(),direction))
- tk.after(125, timer_handler)
- var.set('Hello, World! ..... Left-Click To Reverse ..... ')
- tki.Label(tk, textvariable=var).pack()
- tk.bind("<Button-1>", mouse_handler)
- tk.after(125, timer_handler)
- tk.title('Python Text Animation')
- tki.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement