1 Star 0 Fork 0

Reverier-Xu/ICTFE

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Run.py 1.41 KB
一键复制 编辑 原始数据 按行查看 历史
Reverier-Xu 提交于 2020-04-08 09:58 . Dark theme improved
#!/bin/python3
import sys
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QCursor
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5 import QtGui, QtCore
import MainWindow
class MainWindow(QMainWindow, MainWindow.Ui_MainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.setupUi(self)
self.setWindowIcon(QtGui.QIcon('./Resources/icon.png'))
self.m_flag = False
def mousePressEvent(self, event):
if event.button() == Qt.LeftButton and self.MaxFlag is False:
self.m_flag = True
self.m_Position = event.globalPos() - self.pos() # 获取鼠标相对窗口的位置
event.accept()
self.setCursor(QCursor(Qt.OpenHandCursor)) # 更改鼠标图标
def mouseMoveEvent(self, QMouseEvent):
if Qt.LeftButton and self.m_flag and self.MaxFlag is False:
self.move(QMouseEvent.globalPos() - self.m_Position) # 更改窗口位置
QMouseEvent.accept()
def mouseReleaseEvent(self, QMouseEvent):
self.m_flag = False
self.setCursor(QCursor(Qt.ArrowCursor))
if __name__ == "__main__":
# QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
app = QApplication(sys.argv)
Win = MainWindow()
Win.setWindowTitle('ICTFE')
Win.TypeStack.setCurrentWidget(Win.WelcomePanel)
Win.show()
sys.exit(app.exec_())
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/reverierxu/ICTFE.git
git@gitee.com:reverierxu/ICTFE.git
reverierxu
ICTFE
ICTFE
master

搜索帮助