UpdateLayeredWindowIndirect failed (The parameter is incorrect.)

Been trying to run a py file with PyQt5 imports. Said file is used to present a window designed by another py file (which was created with Qt Designer) and I’m alos using a Json file to add a transition graphic effect for the menu icon, in that when clicked on, it’ll hide or show buttons. However, I keep getting numerous errors when I try to click the menu button:

UpdateLayeredWindowIndirect failed for ptDst=(258, 56), size=(850x607), dirty=(870x600 -9, 18) (The parameter is incorrect.)

I’m not sure what I’m doing wrong. Here’s the code of the file:

import os
import sys

import csv
from propiedades import *


from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from functools import partial
from Custom_Widgets import *
from Custom_Widgets.QAppSettings import QAppSettings

# from PyQt6 import QtGui, QtCharts

# from PySide2.QtGUI import QPainter
# from PySide2.QtCharts import Qcharts
# # from PySide6.QtGUI import QPainter
# # from PySide6.QtCharts import Qcharts



shadow_elements = { "left_menu","frame_3", "frame_5", "header", "frame_8"}

class MainWindow(QMainWindow):
        def __init__(self,parent=None):
            QMainWindow.__init__(self)
            self.ui = Ui_MainWindow()
            self.ui.setupUi(self)
            
            self.setMinimumSize(850,600)
            
            loadJsonStyle(self, self.ui)
            for x in shadow_elements:
                
                effect = QtWidgets.QGraphicsDropShadowEffect(self)
                effect.setBlurRadius(18)
                effect.setXOffset(0)
                effect.setYOffset(0)
                effect.setColor(QColor(0,0,0,255))
                getattr(self.ui,x).setGraphicsEffect(effect)
            
            
            self.show()
            
if __name__ == "__main__":
    import sys
    app = QApplication(sys.argv)
    window = MainWindow()
    window.show()
    sys.exit(app.exec_())

Any advice? Just for the record, I’m running it with Python 3.11.8 though VS Code.

I recommend you use PyQt6 and not the old PyQt5.

What OS are you using?

Can you post the PyQt6 version of code as well as the full traceback you get when you run it outside of CS code from a terminal please?