Dear Team
I will provide you with the code directly, so there is no need for further explanation. Please take a look and try it out for yourself.
I have included many unnecessary packages, which you can remove as needed. I did this to avoid any potential debugging issues that might occur if I forgot to include a particular package. emmm....
import sys
from PyQt5.QtCore import Qt, QPoint
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
class cssden(QMainWindow):
def __init__(self):
super().__init__()
self.setFixedSize(320, 450)
self.setStyleSheet("QMainWindow{background-color: darkgray;border: 1px solid black}")
self.setWindowFlags(Qt.FramelessWindowHint)
def mousePressEvent(self, event):
self.oldPos = event.globalPos()
def mouseMoveEvent(self, event):
delta = QPoint (event.globalPos() - self.oldPos)
self.move(self.x() + delta.x(), self.y() + delta.y())
self.oldPos = event.globalPos()
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = cssden()
ex.show()
sys.exit(app.exec_())
When you open this app, it will display a square window that can be dragged and clicked. You can add additional functions as needed. I only provide you with some insights on how to create this model. Thank you