Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Python timer specific use of the code how to write

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces you how to write the specific code for the use of python timer, the content is very detailed, interested friends can refer to, I hope it can be helpful to you.

There are many problems we need to pay attention to when the python timer is running. Let's take a look at how to solve the problems in the running effect. The code is as follows:

#! / usr/bin/env python import datetime import sys import threading from tkinter import * minute = 60 * int (sys.argv [1]) Curtime = datetime.datetime.now () print ("time is:", Curtime) Scrtime = Curtime + datetime.timedelta (0 minute print) print ("Target time:", Scrtime) def wait (): threading._sleep (minute) def Stat (): Dsttime = datetime.datetime.now () tmp = Dsttime-Scrtime + Scrtime print ("current time:" Tmp) if tmp = = Dsttime: class App (Frame): def _ init__ (self,master = None): Frame.__init__ (self,master) self.pack () myapp = App () myapp.master.title ("time is up") myapp.master.maxsize (150J 0) myapp.mainloop () else: print ("NO") wait () Stat () specific code about the use of python timer is shared here. I hope the above content can be of some help to you and learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report