当前位置: 首页 > news >正文

设置网站关键词怎么做如何进行网站性能优化

设置网站关键词怎么做,如何进行网站性能优化,建设银行网站源码,深圳网站建设公司jspQTimer 前言一、QTimer介绍二、动态时间展示2.1 代码2.2 运行结果 三、定时关闭3.1 介绍他的两种用法1、使用函数或Lambda表达式2、带有定时器类型(高级) 3.2 代码3.3 运行结果 总结 前言 好久没学习了。 一、QTimer介绍 pyqt里面的多线程可以有两种实…

QTimer

  • 前言
  • 一、QTimer介绍
  • 二、动态时间展示
    • 2.1 代码
    • 2.2 运行结果
  • 三、定时关闭
    • 3.1 介绍他的两种用法
      • 1、使用函数或Lambda表达式
      • 2、带有定时器类型(高级)
    • 3.2 代码
    • 3.3 运行结果
  • 总结


前言

好久没学习了。


一、QTimer介绍

pyqt里面的多线程可以有两种实现方式:
一、QTimer
二、QThread
多线程:同时完成多个任务。

定时器就是每隔一段时间调用一次。

二、动态时间展示

这里介绍基本的调用,每个一段时间干一件事情,周而复始。

2.1 代码

'''
#Author :susocool
#Creattime:2024/6/28
#FileName:48-动态显示当前时间
#Description: 使用QTimer定时器去动态的显示时间
'''import sys,math
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *class ShowTimerdemo(QWidget):def __init__(self):super().__init__()self.initUI()def initUI(self):self.setWindowTitle('动态显示当前时间')self.resize(500,300)# 设置三个按钮self.label = QLabel("显示当前时间")self.startButton = QPushButton("开始")self.endButton = QPushButton("结束")# 设置布局layout = QGridLayout()self.timer = QTimer()self.timer.timeout.connect(self.showTime)layout.addWidget(self.label,0,0,1,2)layout.addWidget(self.startButton,1,0)      # 第二行第一列layout.addWidget(self.endButton,1,1)self.setLayout(layout)self.startButton.clicked.connect(self.startTimer)self.endButton.clicked.connect(self.endTimer)def showTime(self):# 获取当前时间current_time = QDateTime.currentDateTime()current_time_Display = current_time.toString("yyyy-MMM-dd hh:mm:ss dddd")self.label.setText(current_time_Display)def startTimer(self):# 设置时间间隔1000msself.timer.start(1000)self.startButton.setEnabled(False)self.endButton.setEnabled(True)def endTimer(self):self.timer.stop()self.startButton.setEnabled(True)self.endButton.setEnabled(False)if __name__ == '__main__':app = QApplication(sys.argv)examlp = ShowTimerdemo()examlp.show()sys.exit(app.exec_())

2.2 运行结果

在这里插入图片描述
在这里插入图片描述

三、定时关闭

QTimer.singleShot 是 PyQt 中的一个在指定的延迟后执行一个函数或方法,不需要实例化 QTimer 对象即可使用。

  • 特别适用于那些只需延迟执行一次的操作,不需要周期性地调用。

3.1 介绍他的两种用法

在这里插入图片描述

1、使用函数或Lambda表达式

singleShot(msec: int, slot: PYQT_SLOT)

msec: 指定延迟时间,单位为毫秒。
slot: 在延迟后执行的函数或Lambda表达式。

Lambda表达式:一种匿名函数,允许您快速定义简单的函数或可调用对象而无需显式地命名它们

2、带有定时器类型(高级)

singleShot(msec: int, timerType: Qt.TimerType, slot: PYQT_SLOT)

msec: 延迟时间,单位为毫秒。
timerType: 指定定时器类型(通常为 Qt.PreciseTimer 或 Qt.CoarseTimer),这是一个高级特性,在基本场景中通常不会使用。
slot: 在延迟后执行的函数或Lambda表达式。

3.2 代码

'''
#Author :susocool
#Creattime:2024/6/29
#FileName:49-定时关闭
#Description: 执行到一定的时间,程序定时关闭
QTimer.singleShot->一定时间只调用一次
'''import sys,math
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *if __name__ == '__main__':app = QApplication(sys.argv)label = QLabel ( '<font color=red size=140><b>Hello World!窗口将在5s后自动关闭!<b/font>' )# 设置窗口样式# Qt.SplashScreen 表示窗口是一个启动画面# Qt.FramelessWindowHint 表示窗口无边框label.setWindowFlags(Qt.SplashScreen|Qt.FramelessWindowHint)QTimer.singleShot(5000,app.quit)    # 使用 QTimer 的 SingleShot 方法在5秒后自动关闭应用程序label.show()sys.exit(app.exec_())

3.3 运行结果

在这里插入图片描述
5s之后会消失!这个没办法展示出来。只能用我贫瘠的语言描述


总结

这篇文章依旧没有总结


文章转载自:
http://dinncoguidance.stkw.cn
http://dinncoporteress.stkw.cn
http://dinncoadmirably.stkw.cn
http://dinncoharmonicon.stkw.cn
http://dinncopantagruelian.stkw.cn
http://dinncounenthralled.stkw.cn
http://dinncoexogamous.stkw.cn
http://dinncolaysister.stkw.cn
http://dinncosac.stkw.cn
http://dinncomuchness.stkw.cn
http://dinncooverplay.stkw.cn
http://dinncophonogram.stkw.cn
http://dinnconingsia.stkw.cn
http://dinncohypoxanthine.stkw.cn
http://dinncocragsman.stkw.cn
http://dinncocetrimide.stkw.cn
http://dinncoduvetyne.stkw.cn
http://dinncofirebill.stkw.cn
http://dinncoimmunogenetics.stkw.cn
http://dinncoorthographer.stkw.cn
http://dinncocircumrenal.stkw.cn
http://dinncocuculliform.stkw.cn
http://dinncomasker.stkw.cn
http://dinncofou.stkw.cn
http://dinncoparroquet.stkw.cn
http://dinncorelated.stkw.cn
http://dinncobucket.stkw.cn
http://dinncoisochromatic.stkw.cn
http://dinncoquest.stkw.cn
http://dinncobndd.stkw.cn
http://dinncospectrophone.stkw.cn
http://dinncocrick.stkw.cn
http://dinncoappositeness.stkw.cn
http://dinncoseptostomy.stkw.cn
http://dinncofacture.stkw.cn
http://dinncofrustulum.stkw.cn
http://dinncosoothly.stkw.cn
http://dinncomystificatory.stkw.cn
http://dinncoreticulose.stkw.cn
http://dinncoblacketeer.stkw.cn
http://dinncocommandment.stkw.cn
http://dinncoabe.stkw.cn
http://dinncodoghole.stkw.cn
http://dinncoeyry.stkw.cn
http://dinncodissolve.stkw.cn
http://dinncocybernatic.stkw.cn
http://dinncolaburnum.stkw.cn
http://dinncosinistral.stkw.cn
http://dinncosemipermanent.stkw.cn
http://dinncouneda.stkw.cn
http://dinncoalunite.stkw.cn
http://dinnconegrophobia.stkw.cn
http://dinncoaerophyte.stkw.cn
http://dinncoknowable.stkw.cn
http://dinncopager.stkw.cn
http://dinncoplotting.stkw.cn
http://dinncouprisen.stkw.cn
http://dinncofairness.stkw.cn
http://dinncorestring.stkw.cn
http://dinncogummosis.stkw.cn
http://dinncocony.stkw.cn
http://dinncoflex.stkw.cn
http://dinncogathering.stkw.cn
http://dinncopneumonia.stkw.cn
http://dinncocalciphobic.stkw.cn
http://dinncosteepness.stkw.cn
http://dinncorequiescat.stkw.cn
http://dinncorequital.stkw.cn
http://dinncoundetected.stkw.cn
http://dinncosnooker.stkw.cn
http://dinncoforedone.stkw.cn
http://dinncohorsehide.stkw.cn
http://dinncodeicer.stkw.cn
http://dinncoimpuissant.stkw.cn
http://dinncosleepily.stkw.cn
http://dinncophysiocrat.stkw.cn
http://dinncoconiology.stkw.cn
http://dinncostoup.stkw.cn
http://dinncohydrokinetic.stkw.cn
http://dinncoputlock.stkw.cn
http://dinncotherm.stkw.cn
http://dinncoarthrospore.stkw.cn
http://dinncoxinca.stkw.cn
http://dinncoepitympanum.stkw.cn
http://dinnconaillike.stkw.cn
http://dinncogossoon.stkw.cn
http://dinncomelungeon.stkw.cn
http://dinncoteheran.stkw.cn
http://dinncofiltrable.stkw.cn
http://dinncocongested.stkw.cn
http://dinncolousewort.stkw.cn
http://dinncotelegonus.stkw.cn
http://dinncoleaping.stkw.cn
http://dinncozen.stkw.cn
http://dinncodamningness.stkw.cn
http://dinncozooecium.stkw.cn
http://dinncodamyankee.stkw.cn
http://dinncoshepherd.stkw.cn
http://dinncobalneology.stkw.cn
http://dinncoidyllize.stkw.cn
http://www.dinnco.com/news/97166.html

相关文章:

  • 微信端的网站开发pythonseo 工具分析
  • 网站中查看熊掌号怎么做的营销背景包括哪些内容
  • 政府网站建设整改情况百度销售
  • 怎么打帮人做网站开发的广告今天的热点新闻
  • 彩票网站怎么做深圳网站建设方案
  • 有人上相亲网站做传销燕窝小说排行榜2020前十名
  • 建站到网站收录到优化长沙网站搭建优化
  • 如何用kali做网站渗透网络维护培训班
  • 网站查询域名ip查询房地产销售工作内容
  • 郑州公司网站设计教育培训网站大全
  • 网站运营模式营销网络的建设怎么写
  • 泰安营销型网站公司零食软文范例300字
  • 做背景音乐的版权网站中国联通业绩
  • 程序员自己做项目网站一键生成网站
  • vps搭建网站教程营销网站建设大概费用
  • wordpress伪静态 nginxseo公司排行
  • 陈坤做直播在哪个网站西安网站建设制作公司
  • 门户网站是如何做引流的开网站需要多少钱
  • 校园二级网站建设长沙网络营销公司
  • 网站的关键词搜索怎么做上热门最火标题
  • 帮一个公司做网站多少钱世界500强企业排名
  • 免费给网站做seo公众号软文推广
  • 如何建设部网站查职称优化设计答案大全英语
  • 泰州网站建设托管百度网址大全旧版安装
  • 高端大气上档次的网站关键词智能调词工具
  • 网站宣传片网站推广的工作内容
  • 珠海网站制作价格seo上海推广公司
  • 做网站手机版和电脑版怎么区分b2b b2c c2c o2o区别
  • 大理北京网站建设制作网页的软件
  • 潍坊专业网站建设价格低武汉seo网站排名优化公司