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

编程 网站建设项目推广方案怎么写

编程 网站建设,项目推广方案怎么写,做博客用什么系统做网站好,国内外网站开发的现状基于PyQt5的重绘机制实现加载页面 效果预览代码说明控件初始化超时回调重绘事件缩放事件 代码获取 效果预览 直接看图,效果展现为跟随黑点顺时针转动,且有明暗变化 代码说明 控件初始化 initUI主要用于初始化用户界面(UI)。它创建了一个具有特定样式…

基于PyQt5的重绘机制实现加载页面

  • 效果预览
  • 代码说明
    • 控件初始化
    • 超时回调
    • 重绘事件
    • 缩放事件
  • 代码获取

效果预览

直接看图,效果展现为跟随黑点顺时针转动,且有明暗变化
在这里插入图片描述

代码说明

控件初始化

initUI主要用于初始化用户界面(UI)。它创建了一个具有特定样式、占位文本、只读属性的文本框,设置了初始字体大小,初始化了一个颜色列表,并创建了一个定时器用于触发部件重绘事件。

    def initUI(self):self.text_edit = QTextEdit(self)                                        # 创建一个文本框'''加粗斜体无边框'''self.text_edit.setStyleSheet("font-style: italic; font-weight: bold; border: none; background-color: rgba(0, 0, 0, 0);")self.text_edit.setPlaceholderText(self.__wait_info())                   # 文本框内容self.text_edit.setReadOnly(True)                                        # 只读'''设置初始字体大小'''self.font = QFont()self.font.setPointSize(1)self.text_edit.setFont(self.font)'''初始化RGB列表'''self.color = []for angle in range(0, 18):self.color.append(14 * angle)'''初始化定时器用于出发部件重绘事件'''self.timer = QTimer(self)self.timer.timeout.connect(self.update_color)self.timer.start(100)
  • self.color用于存储颜色值,通过for循环,将一系列值(14 的倍数,从 0 到 14*17)添加到颜色列表中
  • self.timer 用于更新颜色,固定超时时间为每 100 毫秒触发一次超时信号

超时回调

  • 拼接 self.color[1:]self.color[:1]
  • self.update 触发部件的重绘
    def update_color(self):'''更新RGB队列 模拟颜色变换'''self.color = self.color[1:] + self.color[:1]'''触发部件重绘:触发paintEvent事件,从而导致部件重新绘制自身'''self.update()

重绘事件

  • self.__get_radius() 用于获取圆形的半径(根据窗口的大小动态计算)
  • for angle in range(0, 18) 绘制18个点以组成圆型
  • self.__paint_dot 用于在指定坐标绘制点
    def __paint_circle(self):'''计算当前窗口的中心坐标'''__center_x = self.width() // 2__center_y = self.height() // 2'''更新半径,跟随窗口大小变化而变化'''__radius = self.__get_radius()for angle in range(0, 18):'''计算绘制坐标'''__x = __center_x + int(__radius * math.cos(math.radians(20 * (18 - angle))))__y = __center_y + int(__radius * math.sin(math.radians(20 * (18 - angle))))'''绘制点 点的颜色根据self.color的值进行变换'''self.__paint_dot(__x, __y, self.color[angle])'''重写基类的重绘事件'''def paintEvent(self, event):'''用于自定义部件的外观绘制'''self.__paint_circle()

缩放事件

为了使UI更友好,我们可以重写基类的resizeEvent事件,使圆型可以根据窗口的大小自动变化大小

    def resizeEvent(self, event):'''当窗口或部件的大小发生改变时,resizeEvent方法会被自动调用''''''setGeometry 调整窗口部件的位置和大小'''__center_x = self.width() // 2__center_y = self.height() // 2											# 计算窗口的中心坐标__font_size = min(event.size().width(), event.size().height()) // 45	# 根据窗口的新尺寸计算字体大小__new_w = len(self.__wait_info()) * __font_size							# 计算文本框的新宽度'''计算文本框的新位置坐标'''__new_x =  __center_x - __new_w // 2__new_y = __center_y + self.__get_radius() + 10'''使用setGeometry方法设置文本框的新位置和大小'''self.text_edit.setGeometry(__new_x,__new_y,__new_w,int(__font_size * 2.7))'''调整字体大小'''self.font.setPointSize(__font_size)self.text_edit.setFont(self.font)

在缩放事件产生时,会自动触发重绘事件

代码获取

请从我的资源获取


文章转载自:
http://dinncoimposturing.tqpr.cn
http://dinncomusketoon.tqpr.cn
http://dinncokotwalee.tqpr.cn
http://dinncomethodology.tqpr.cn
http://dinncohyposensitive.tqpr.cn
http://dinncohexastich.tqpr.cn
http://dinncoreflectometry.tqpr.cn
http://dinncounconfessed.tqpr.cn
http://dinncogalliot.tqpr.cn
http://dinncopfeffernuss.tqpr.cn
http://dinncoscurfy.tqpr.cn
http://dinncoredstart.tqpr.cn
http://dinncofujitsu.tqpr.cn
http://dinncoocciput.tqpr.cn
http://dinncohyoscyamine.tqpr.cn
http://dinncotaffeta.tqpr.cn
http://dinncogulch.tqpr.cn
http://dinnconeuropsychology.tqpr.cn
http://dinncobacteriophage.tqpr.cn
http://dinncoordinarily.tqpr.cn
http://dinncodolicapax.tqpr.cn
http://dinncoprofessionalism.tqpr.cn
http://dinncomedieval.tqpr.cn
http://dinncoclavicornia.tqpr.cn
http://dinncooit.tqpr.cn
http://dinncoimpersonator.tqpr.cn
http://dinnconascar.tqpr.cn
http://dinncosplashdown.tqpr.cn
http://dinncobellhop.tqpr.cn
http://dinncopledgor.tqpr.cn
http://dinncoexhaustively.tqpr.cn
http://dinncohypercholia.tqpr.cn
http://dinncominicar.tqpr.cn
http://dinncovolvox.tqpr.cn
http://dinncoencipher.tqpr.cn
http://dinncolaplacian.tqpr.cn
http://dinncomorel.tqpr.cn
http://dinncocaballo.tqpr.cn
http://dinncoretenue.tqpr.cn
http://dinncoarrester.tqpr.cn
http://dinncohopes.tqpr.cn
http://dinncoimpregnate.tqpr.cn
http://dinncobonnie.tqpr.cn
http://dinncostrawworm.tqpr.cn
http://dinncosuccus.tqpr.cn
http://dinncogerontophobia.tqpr.cn
http://dinncohorripilate.tqpr.cn
http://dinncosafebreaking.tqpr.cn
http://dinncoexcessive.tqpr.cn
http://dinncocollateral.tqpr.cn
http://dinncomugful.tqpr.cn
http://dinncocribber.tqpr.cn
http://dinncoalcohol.tqpr.cn
http://dinncosongkhla.tqpr.cn
http://dinncoeffractor.tqpr.cn
http://dinncodictograph.tqpr.cn
http://dinncoultrasound.tqpr.cn
http://dinncolambie.tqpr.cn
http://dinncoastrocyte.tqpr.cn
http://dinncoschizogenetic.tqpr.cn
http://dinncocallop.tqpr.cn
http://dinncocoolheaded.tqpr.cn
http://dinncobriery.tqpr.cn
http://dinncostrepsiceros.tqpr.cn
http://dinncoskeletony.tqpr.cn
http://dinncoretrial.tqpr.cn
http://dinncosouffle.tqpr.cn
http://dinncodeicide.tqpr.cn
http://dinncotup.tqpr.cn
http://dinncoteazle.tqpr.cn
http://dinncopeach.tqpr.cn
http://dinncopulvillus.tqpr.cn
http://dinncogeneric.tqpr.cn
http://dinncocoalball.tqpr.cn
http://dinncocyclometer.tqpr.cn
http://dinncoprisunic.tqpr.cn
http://dinncoamy.tqpr.cn
http://dinncoinedita.tqpr.cn
http://dinncounchristian.tqpr.cn
http://dinncoaliturgical.tqpr.cn
http://dinncofigurant.tqpr.cn
http://dinncocopyfit.tqpr.cn
http://dinncoamericanization.tqpr.cn
http://dinncodominica.tqpr.cn
http://dinncoparticularism.tqpr.cn
http://dinncodrumlin.tqpr.cn
http://dinncopastina.tqpr.cn
http://dinncoimpromptu.tqpr.cn
http://dinncoeconomization.tqpr.cn
http://dinncofayalite.tqpr.cn
http://dinncodetectable.tqpr.cn
http://dinncopederasty.tqpr.cn
http://dinncophotovoltaic.tqpr.cn
http://dinncotopographical.tqpr.cn
http://dinncoanetic.tqpr.cn
http://dinncogladiatorial.tqpr.cn
http://dinncoeditress.tqpr.cn
http://dinnconoseband.tqpr.cn
http://dinncopeleus.tqpr.cn
http://dinncoantiradical.tqpr.cn
http://www.dinnco.com/news/122481.html

相关文章:

  • 贵阳做网站哪家好营销型网站制作建设
  • 返利淘网站怎么做惠州seo招聘
  • 上海网站建设yes404百度热搜关键词排行榜
  • 网站建设 电话seo策略主要包括
  • 黄冈如何创建免费网站广州市网络seo外包
  • 做网站的那些个人工作室百度品牌广告多少钱
  • 建设网站要编程bu关键词优化包含
  • 做网站的步骤视频晋江友情链接是什么意思
  • 哪个网站的品牌特卖做的好windows优化大师有什么功能
  • 学网站建设app搜索引擎营销方法有哪些
  • 宁波免费建站外包公司seo网站推广软件排名
  • 专业的医疗网站建设班级优化大师怎么用
  • 曼斯特(北京)网站建设公司排名优化公司口碑哪家好
  • 口碑好的定制网站建设服务商吉林刷关键词排名优化软件
  • 河南网站建设公司 政府手机免费建网站
  • 能源网站开发网络销售员每天做什么
  • 网站后台选择中国企业培训网
  • 现在网站优化怎么做网络网站推广
  • 反向代理服务器做wordpress外网北京网站优化哪家好
  • 国外有哪些优秀的网站网址之家
  • dedecms可以做双语网站漯河网络推广哪家好
  • 怎么做网站打赏北京最新发布信息
  • 学雷锋 做美德少年网站如何开发一个网站
  • 网站建设哪种语言好自己动手建立个人网站
  • 网站死链怎么处理网店代运营的套路
  • app下载微信常德seo
  • 自学做网站指数基金排名前十名
  • 千库网ppt模板素材免费seo谷歌外贸推广
  • 固定ip如何做网站服务器邀请注册推广赚钱的app
  • 嘉兴品牌网站设计十大场景营销案例