Get the App
SLTechnology News&Howtos  ›  Development  › 

Python timer specific use of the code how to write

Shulou Source: shulou.com Published: 2022-06-02 21:52:51 09月16日 Update

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.

Tags: Time code timer content more questions help run good interest guys buddies effects articles times goals knowledge articles references Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Apple Microsoft Shulou Tech Info Shulou Information