当前位置:网站首页>Kivy tutorial 08 countdown app implements timer call (tutorial includes source code)
Kivy tutorial 08 countdown app implements timer call (tutorial includes source code)
2022-07-04 12:36:00 【Knowledge fatness】
Actual combat needs
count down App Realization timer call
Running effect
Solution
1. introduce Clock Components
from kivy.clock import Clock
2. Clock Component implementation timer
def on_start(self):
Clock.schedule_interval(self.update, 0)
3. update Callback update interface
def update(self, nap):
# print('update')
if self.sw_started:
self.sw_seconds += nap
m, s = divmod(self.sw_seconds, 60)
self.root.ids.time.text = ('%02d:%02d.[size=40]%02d[/size]' %(int(m), int(s), int(s * 100 % 100)))
adopt on_press To specify the response function
Complete code
from kivy.app import App
from kivy.lang import Builder
from kivy.core.window import Window
from kivy.utils import get_co
边栏推荐
- MYCAT middleware installation and use
- Ultimate bug finding method - two points
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 9
- How to disable debug messages on sockjs stomp - how to disable debug messages on sockjs Stomp
- The latest idea activation cracking tutorial, idea permanent activation code, the strongest in history
- Review of week 278 of leetcode II
- When synchronized encounters this thing, there is a big hole, pay attention!
- OSI seven layer model & unit
- Hongke case study on storm impact in coastal areas of North Carolina using lidar
- 2022, 6G is heating up
猜你喜欢
Paper notes ACL 2020 improving event detection via open domain trigger knowledge
How to use "bottom logic" to see the cards in the world?
Leetcode: 408 sliding window median
0x15 string
Leetcode day 17
The database connection code determines whether the account password is correct, but the correct account password always jumps to the failure page with wrong account password
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 23
Detailed explanation of NPM installation and caching mechanism
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 14
Ultimate bug finding method - two points
随机推荐
TCP fast retransmission sack mechanism
Exness: positive I win, negative you lose
JD home programmers delete databases and run away. Talk about binlog, the killer of MySQL data backup
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 24
Reptile learning 3 (winter vacation learning)
How to disable debug messages on sockjs stomp - how to disable debug messages on sockjs Stomp
The solution of permission denied
LVS load balancing cluster deployment - Dr direct routing mode
In 2022, financial products are not guaranteed?
Globalsign's SSL certificate products
French Data Protection Agency: using Google Analytics or violating gdpr
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 12
Hongke case study on storm impact in coastal areas of North Carolina using lidar
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 16
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 18
MPLS experiment
Entity framework calls Max on null on records - Entity Framework calling Max on null on records
Introduction to random and threadlocalrandom analysis
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 15
Interview question MySQL transaction (TCL) isolation (four characteristics)