PySide doesn't find the plagues of images



  • If a list of formats is requested:

    app = QApplication(sys.argv)
    image_formats = [str(_) for _ in QImageReader.supportedImageFormats()]
    print(image_formats)
    

    not all will return (jpg/jpeg, for example: not):

    ['bmp', 'pbm', 'pgm', 'png', 'ppm', 'xbm', 'xpm']
    


  • There's a file in PySide. plugins With all the right flames, but they need to be added manually. QCoreApplication (or his heirs) by addLibraryPath:

    def load_pyside_plugins():
        """
        Функция загружает Qt плагины.
    
    """
    
    import PySide
    import os
    
    qApp = PySide.QtGui.QApplication.instance()
    
    for plugins_dir in [os.path.join(p, "plugins") for p in PySide.__path__]:
        qApp.addLibraryPath(plugins_dir)
    

    Check:

    app = QApplication(sys.argv)

    load_pyside_plugins()
    image_formats = [str(_) for _ in QImageReader.supportedImageFormats()]
    print(image_formats)

    Consul:

    ['bmp', 'gif', 'ico', 'jpeg', 'jpg', 'mng', 'pbm', 'pgm', 'png', 'ppm', 'tga', 'tif', 'tiff', 'xbm', 'xpm']


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2