I've been trying to implement methods to add some shadow effects to some parts of the UI (i.e. the header and footer) and was told to import/install PySide (or PyQt) and QT-PyQt-PySide-Custom-Widgets (note I have PyQt5/6 and PySide6 installed) However, setGraphicsEffects doesn't seem to work. In other words, it acts like there is no said function available. Not only that, but when I run it, it gives me an OS error:
Traceback (most recent call last):
File "C:\Users\UserPC\OneDrive\Documentos\ProjectSICI\propiedadesmain.py", line 11, in <module>
from Custom_Widgets.Widgets import *
File "C:\Users\UserPC\AppData\Local\Programs\Python\Python311\Lib\site-packages\Custom_Widgets\__init__.py", line 12, in <module>
from Custom_Widgets.Qss.SvgToPngIcons import NewIconsGenerator
File "C:\Users\UserPC\AppData\Local\Programs\Python\Python311\Lib\site-packages\Custom_Widgets\Qss\SvgToPngIcons.py", line 22, in <module>
import cairosvg
File "C:\Users\UserPC\AppData\Local\Programs\Python\Python311\Lib\site-packages\cairosvg\__init__.py", line 26, in <module>
from . import surface # noqa isort:skip
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\UserPC\AppData\Local\Programs\Python\Python311\Lib\site-packages\cairosvg\surface.py", line 9, in <module>
import cairocffi as cairo
File "C:\Users\UserPC\AppData\Local\Programs\Python\Python311\Lib\site-packages\cairocffi\__init__.py", line 47, in <module>
cairo = dlopen(
^^^^^^^
File "C:\Users\UserPC\AppData\Local\Programs\Python\Python311\Lib\site-packages\cairocffi\__init__.py", line 44, in dlopen
raise OSError(error_message) # pragma: no cover
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: no library called "cairo-2" was found
no library called "cairo" was found
no library called "libcairo-2" was found
cannot load library 'libcairo.so.2': error 0x7e. Additionally, ctypes.util.find_library() did not manage to locate a library called 'libcairo.so.2'
cannot load library 'libcairo.2.dylib': error 0x7e. Additionally, ctypes.util.find_library() did not manage to locate a library called 'libcairo.2.dylib'
cannot load library 'libcairo-2.dll': error 0x7e. Additionally, ctypes.util.find_library() did not manage to locate a library called 'libcairo-2.dll'
Here's the whole script of the file for reference:
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 Custom_Widgets.Widgets import *
from PySide6.QtGui import *
from PySide6.QtCore import *
from PySide6.QtWidgets import *
from functools import partial
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 = QMainWindow()
window.show()
sys.exit(app.exec_())
AM I missing something? Does it have to do with QT-PyQt-PySide-Custom-Widgets? Note that I'm using Python 3.11. I tried to use Python 3.12 but the PyQt6 tools aren't supported with it.