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

网站怎么收录宿迁房产网商铺

网站怎么收录,宿迁房产网商铺,网站后台 栏目管理,wordpress totalpoll此程序大致功能为#xff1a;可变换颜色#xff0c;贴边隐藏。变换颜色思路QPalette( [ˈplət] 调色板)类相当于对话框或控件的调色板#xff0c;它管理着控件或窗体的所有颜色信息#xff0c;每个窗体或控件都包含一个QPalette对象#xff0c;在显示时按照它的QPalette对…此程序大致功能为可变换颜色贴边隐藏。变换颜色思路QPalette( [ˈpælət] 调色板)类相当于对话框或控件的调色板它管理着控件或窗体的所有颜色信息每个窗体或控件都包含一个QPalette对象在显示时按照它的QPalette对象中对各部分各状态下的颜色的描述来进行绘制。实现代码def Painting(self): color random.choice([CCFFFF,CC6699,CC99FF,99CCFF]) palette1 QPalette() palette1.setColor(self.backgroundRole(), QColor(#{}.format(color))) # 改变窗体颜色 self.setPalette(palette1)贴边隐藏思路可以判断窗口的位置当与边缘的距离小于某值时再判断鼠标是否在窗口判断是否隐藏窗口根据隐藏窗口的隐藏位置获得某块区域当鼠标在这个位置时显示窗口。实现代码鼠标进入事件调用hide_or_show判断是否该显示def enterEvent(self, event): self.hide_or_show(show, event)鼠标离开事件调用hide_or_show判断是否该隐藏def leaveEvent(self, event): self.hide_or_show(hide, event)鼠标点击事件def mousePressEvent(self, event): if event.button() Qt.LeftButton: self.dragPosition event.globalPos() - self.frameGeometry( ).topLeft() QApplication.postEvent(self, QEvent(174)) event.accept()捕捉鼠标移动事件def mouseMoveEvent(self, event): if event.buttons() Qt.LeftButton: try: self.move(event.globalPos() - self.dragPosition) event.accept() except:pass判断是否该隐藏def hide_or_show(self, mode, event): pos self.frameGeometry().topLeft() if mode show and self.moved: if pos.x() WINDOW_WEIGHT SCREEN_WEIGHT: # 右侧显示 self.startAnimation(SCREEN_WEIGHT - WINDOW_WEIGHT 2, pos.y()) event.accept() self.moved False elif pos.x() 0: # 左侧显示 self.startAnimation(0,pos.y()) event.accept() self.moved False elif pos.y() 0: # 顶层显示 self.startAnimation(pos.x(),0) event.accept() self.moved False elif mode hide: if pos.x() WINDOW_WEIGHT SCREEN_WEIGHT: # 右侧隐藏 self.startAnimation(SCREEN_WEIGHT - 2,pos.y()) event.accept() self.moved True elif pos.x() 2: # 左侧隐藏 self.startAnimation(2 - WINDOW_WEIGHT,pos.y()) event.accept() self.moved True elif pos.y() 2: # 顶层隐藏 self.startAnimation(pos.x(),2 - WINDOW_HEIGHT) event.accept() self.moved True将划入划出作为属性动画def startAnimation(self,width,height): animation QPropertyAnimation(self,bgeometry,self) startpos self.geometry() animation.setDuration(200) newpos QRect(width,height,startpos.width(),startpos.height()) animation.setEndValue(newpos) animation.start()完整代码import sys,randomfrom PyQt5.QtGui import QPalette,QColorfrom PyQt5.QtWidgets import QWidget,QVBoxLayout,QPushButton, QDesktopWidget,QApplicationfrom PyQt5.QtCore import Qt,QRect,QEvent,QPointfrom PyQt5.Qt import QCursor,QPropertyAnimationSCREEN_WEIGHT 1920SCREEN_HEIGHT 1080WINDOW_WEIGHT 300WINDOW_HEIGHT 600class Ui_Form(QWidget): def __init__(self): self.moved False super(Ui_Form,self).__init__() self.setupUi() self.resize(WINDOW_WEIGHT, WINDOW_HEIGHT) self.show() def setupUi(self): self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint | Qt.Tool) # 去掉标题栏 self.widget QWidget() self.Layout QVBoxLayout(self.widget) self.Layout.setContentsMargins(0,0,0,0) self.setLayout(self.Layout) self.setWindowFlag(Qt.Tool) self.main_widget QWidget() self.Layout.addWidget(self.main_widget) self.paint QPushButton(self.main_widget) self.paint.setText(改变颜色) self.paint.move(QPoint(120,200)) self.paint.clicked.connect(self.Painting) self.exit QPushButton(self.main_widget) self.exit.setText( 退出 ) self.exit.move(QPoint(120,400)) self.exit.clicked.connect(lambda:exit(0)) self.setStyleSheet( QPushButton { color: rgb(137, 221, 255); background-color: rgb(37, 121, 255); border-style:none; border:1px solid #3f3f3f; padding:5px; min-height:20px; border-radius:15px; } ) def Painting(self): color random.choice([CCFFFF,CC6699,CC99FF,99CCFF]) palette1 QPalette() palette1.setColor(self.backgroundRole(), QColor(#{}.format(color))) # 改变窗体颜色 self.setPalette(palette1) def enterEvent(self, event): self.hide_or_show(show, event) def leaveEvent(self, event): self.hide_or_show(hide, event) def mousePressEvent(self, event): if event.button() Qt.LeftButton: self.dragPosition event.globalPos() - self.frameGeometry( ).topLeft() QApplication.postEvent(self, QEvent(174)) event.accept() def mouseMoveEvent(self, event): if event.buttons() Qt.LeftButton: try: self.move(event.globalPos() - self.dragPosition) event.accept() except:pass #def mouseReleaseEvent(self, event): #self.moved True #self.hide_or_show(show, event) def hide_or_show(self, mode, event): pos self.frameGeometry().topLeft() if mode show and self.moved: if pos.x() WINDOW_WEIGHT SCREEN_WEIGHT: # 右侧显示 self.startAnimation(SCREEN_WEIGHT - WINDOW_WEIGHT 2, pos.y()) event.accept() self.moved False elif pos.x() 0: # 左侧显示 self.startAnimation(0,pos.y()) event.accept() self.moved False elif pos.y() 0: # 顶层显示 self.startAnimation(pos.x(),0) event.accept() self.moved False elif mode hide: if pos.x() WINDOW_WEIGHT SCREEN_WEIGHT: # 右侧隐藏 self.startAnimation(SCREEN_WEIGHT - 2,pos.y()) event.accept() self.moved True elif pos.x() 2: # 左侧隐藏 self.startAnimation(2 - WINDOW_WEIGHT,pos.y()) event.accept() self.moved True elif pos.y() 2: # 顶层隐藏 self.startAnimation(pos.x(),2 - WINDOW_HEIGHT) event.accept() self.moved True def startAnimation(self,width,height): animation QPropertyAnimation(self,bgeometry,self) startpos self.geometry() animation.setDuration(200) newpos QRect(width,height,startpos.width(),startpos.height()) animation.setEndValue(newpos) animation.start()if __name__ __main__: app QApplication(sys.argv) ui Ui_Form() sys.exit(app.exec_())源码获取加群哦1136192749
http://www.pierceye.com/news/367970/

相关文章:

  • 网站备案报价深圳市住房和建设局官网首页
  • 宁波江北区网站推广联系方式做一个论坛网站要多少钱
  • 网站制作无锡台州建设工程网站
  • 云网站 制作如何做一个网页
  • 微信免费建站新建网站站点的
  • 云网站制作的流程世界500强企业排名
  • 巨久科技网站建设做出个人网站什么水平
  • 做外贸网站怎么做做网站3个月
  • 县局网站建设招标网站建设人文类
  • 网站开发亿玛酷给力5上海logo在线制作
  • 网站重新备案搞个网站需要多少钱
  • 海南微信网站制作平台网络计划的优化
  • 域名的正确书写格式自动seo优化
  • 怎样在网站做友情链接网页什么设计
  • 做seo网站营销推广南宁建设职业技术学院招聘信息网站
  • 网站建设全网推广小程序手机网站怎么优化
  • wordpress 网站logowin系统没有wordpress
  • 玉山电商网站建设东莞市建设规划局网站
  • 网站建设运营公司企业特色c2c的代表性的电商平台
  • 上海网站建设,分类广告软件公司简介
  • 网站虚拟主机被国家禁止访问的网站怎么打开
  • wordpress手机加载不出来优化官网咨询
  • 平台网站建设预算表如何来做网站
  • 温州网站制作企业东莞网络推广公司电话
  • 网站建设的条件重庆那些网站
  • 伊犁网站制作大连甘井子区房价
  • 循环视频做网站背景win2012r2 建设网站
  • 建设网站制作汉狮团队义乌北苑编程网站开发公司
  • 网站开发公司会计处理滨州市住房和城乡建设局网站
  • 企业网站站内优化长尾关键词挖掘站长工具