June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
23
Task/Animation/Python/animation-3.py
Normal file
23
Task/Animation/Python/animation-3.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
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! ')
|
||||
tki.Label(tk, textvariable=var).pack()
|
||||
tk.bind("<Button-1>", mouse_handler)
|
||||
tk.after(125, timer_handler)
|
||||
tk.title('Python Animation')
|
||||
tki.mainloop()
|
||||
Loading…
Add table
Add a link
Reference in a new issue