def main(): app = QApplication(sys.argv) if sys.platform == 'win32': app.addLibraryPath('win') frm = MainForm() frm.show() app.exec_()
class MainWindow(QWidget): def __init__(self, parent=None): super().__init__(parent) layout = QVBoxLayout(self) for size in (16, 22, 32, 64): icon = QIcon( ':/icons/custom-theme/places/{}/folder-important.svg'.format( size ) ) button = QPushButton(self) button.setIconSize(QSize(size, size)) button.setIcon(QIcon.fromTheme('folder-important', icon)) layout.addWidget(button) if __name__ == '__main__': app = QApplication(sys.argv) if hasattr(sys, 'frozen'): app_path = os.path.dirname(sys.executable) plugins_path = os.path.join(app_path, 'plugins') app.addLibraryPath(plugins_path) QIcon.setThemeName('custom-theme') main_window = MainWindow() main_window.show() sys.exit(app.exec_())