修改 qsl4ahelper.fullscreenwrapper2.py —— 本次内容不是非常具体,但懂的话,会很快处理完成。
1、添加Timer并事件
1.1、在Layout 构造中添加
#触发时间间隔
self.Interval=0
#触发回调函数
self.TimeTick=None
#是否起作用
self.TimeEnable=False
1.2、在FullScreenWrapper2App中,处理Timer
t0 = time.time()
......
if None==evt:
if (cls.mlayout.Interval>0) and (cls.mlayout.TimeTick!=None) and cls.mlayout.TimeEnable:
if time.time()-cls.mlayout.Interval>t0:
cls.mlayout.TimeTick()
t0 = time.time()
continue
1.3、使用的地方,就容易了。
def ShowInfo():
print(timw.time())
def initialize():
MyScreen.Interval=0.5 #触发间隔
MyScreen.TimeTick=ShowInfo #注册回调
...............
MyScreen.TimeEnable=True #启用
..............
MyScreen.TimeEnable=False #停用
2、其它修改,增加容错
3、案例
做的简易音乐播放,指定目录中的mp3逐首播放、循环,,,,参考了B站的up主 “乘着船” 的文章。。。。