1 Star 0 Fork 13

lzh_22/pyqt5-360ui

forked from apud/pyqt5-360ui 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
frmmain.py 4.18 KB
一键复制 编辑 原始数据 按行查看 历史
apud 提交于 2020-01-05 21:28 . v1.0.0
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
作者:消逝
QQ交流群:540681925
"""
import sys
from frmmain_ui import Ui_frmMain
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
class frmMain(QMainWindow):
def __init__(self, parent=None):
super(frmMain, self).__init__(parent)
self.ui = Ui_frmMain()
self.ui.setupUi(self)
self.setWindowFlags(Qt.FramelessWindowHint)
self.ui.closeToolButton.clicked.connect(self.on_closeToolButton_clicked)
self.ui.minToolButton.clicked.connect(self.on_minToolButton_clicked)
self.ui.killToolButton.clicked.connect(self.on_killToolButton_clicked)
self.ui.checkToolButton_2.clicked.connect(self.on_checkToolButton_2_clicked)
self.ui.fixToolButton.clicked.connect(self.on_fixToolButton_clicked)
self.ui.rabToolButton.clicked.connect(self.on_rabToolButton_clicked)
self.ui.opToolButton.clicked.connect(self.on_opToolButton_clicked)
self.ui.exToolButton.clicked.connect(self.on_exToolButton_clicked)
self.ui.mzToolButton.clicked.connect(self.on_mzToolButton_clicked)
self.ui.gjToolButton.clicked.connect(self.on_gjToolButton_clicked)
def mousePressEvent(self,event):
if ( event.button() == Qt.LeftButton ):
self.startPos = event.globalPos() - self.frameGeometry().topLeft()
elif ( event.button() == Qt.MiddleButton):
self.closeWindow()
elif( event.button() == Qt.RightButton ):
self.shakeWindow()
def mouseMoveEvent(self,event):
if ( event.buttons() == Qt.LeftButton ):
self.endPos = event.globalPos() - self.startPos
self.move(self.endPos)
def on_closeToolButton_clicked(self):
self.closeWindow()
def on_minToolButton_clicked(self):
self.showMinimized()
def shakeWindow(self):
animation = QPropertyAnimation(self,"geometry")
animation.setDuration(500)
animation.setKeyValueAt(0,QRect(QPoint(self.frameGeometry().x()-3,self.frameGeometry().y()),self.size()))
animation.setKeyValueAt(0.1,QRect(QPoint(self.frameGeometry().x()+6,self.frameGeometry().y()),self.size()))
animation.setKeyValueAt(0.2,QRect(QPoint(self.frameGeometry().x()-6,self.frameGeometry().y()),self.size()))
animation.setKeyValueAt(0.3,QRect(QPoint(self.frameGeometry().x()+6,self.frameGeometry().y()),self.size()))
animation.setKeyValueAt(0.4,QRect(QPoint(self.frameGeometry().x()-6,self.frameGeometry().y()),self.size()))
animation.setKeyValueAt(0.5,QRect(QPoint(self.frameGeometry().x()+6,self.frameGeometry().y()),self.size()))
animation.setKeyValueAt(0.6,QRect(QPoint(self.frameGeometry().x()-6,self.frameGeometry().y()),self.size()))
animation.setKeyValueAt(0.7,QRect(QPoint(self.frameGeometry().x()+6,self.frameGeometry().y()),self.size()))
animation.setKeyValueAt(0.8,QRect(QPoint(self.frameGeometry().x()-6,self.frameGeometry().y()),self.size()))
animation.setKeyValueAt(0.9,QRect(QPoint(self.frameGeometry().x()+6,self.frameGeometry().y()),self.size()))
animation.setKeyValueAt(1,QRect(QPoint(self.frameGeometry().x()-3,self.frameGeometry().y()),self.size()))
animation.start()
def setStackCurrentPage(self,index):
widget =QWidget()
widget = self.ui.stackedWidget.widget(index)
self.ui.stackedWidget.setCurrentWidget(widget)
def closeWindow(self):
sys.exit(app.exec_())
def on_killToolButton_clicked(self):
self.setStackCurrentPage(1)
def on_checkToolButton_2_clicked(self):
self.setStackCurrentPage(0)
def on_fixToolButton_clicked(self):
self.setStackCurrentPage(2)
def on_rabToolButton_clicked(self):
self.setStackCurrentPage(3)
def on_opToolButton_clicked(self):
self.setStackCurrentPage(4)
def on_exToolButton_clicked(self):
self.setStackCurrentPage(5)
def on_mzToolButton_clicked(self):
self.setStackCurrentPage(6)
def on_gjToolButton_clicked(self):
self.setStackCurrentPage(7)
if __name__ == "__main__":
app = QApplication(sys.argv[1:])
window = frmMain()
window.show()
sys.exit(app.exec_())
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/lzh_22/pyqt5-360ui.git
git@gitee.com:lzh_22/pyqt5-360ui.git
lzh_22
pyqt5-360ui
pyqt5-360ui
master

搜索帮助