大佬进,有个python问题请教
就是我想点击开始它就继续滚动字幕,点击暂停就暂停滚动,这个怎么实现,现在卡到这步了 来个大佬帮下忙 借楼,问个问题。这两组数据的关系2dc5de4b61607e3650031ebcfcf392d4
19-01-25-70-54-00-21-20 暂停就是读出X,定位置label.place就行了,buttom后面加command参数指定运行哪个函数吧 建议楼主找个书看 tk好久没用了,感觉好像是顺序的问题,这个例子可能会帮到你
# import tkinter
try:
import tkinter as tk
except ImportError:
import Tkinter as tk
class Timer:
def __init__(self, parent):
# variable storing time
self.seconds = 0
# label displaying time
self.label = tk.Label(parent, text="0 s", font="Arial 30", width=10)
self.label.pack()
# start the timer
self.label.after(1000, self.refresh_label)
def refresh_label(self):
""" refresh the content of the label every second """
# increment the time
self.seconds += 1
# display the new time
self.label.configure(text="%i s" % self.seconds)
# request tkinter to call self.refresh after 1s (the delay is given in ms)
self.label.after(1000, self.refresh_label)
if __name__ == "__main__":
root = tk.Tk()
timer = Timer(root)
root.mainloop()
页:
[1]