-1
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'C:\Users\Χρήστος\Desktop\Papinhio player\project\main\ui files\Menu 1\Sound files\Import sound file\Loading image\loading.ui'
#
# Created by: PyQt5 UI code generator 5.15.0
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again.  Do not edit this file unless you know what you are doing.


from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtGui import QMovie

class Ui_dialog(object):
    def setupUi(self, dialog):
        dialog.setObjectName("dialog")
        dialog.resize(430, 110)
        self.horizontalLayout = QtWidgets.QHBoxLayout(dialog)
        self.horizontalLayout.setObjectName("horizontalLayout")
        spacerItem = QtWidgets.QSpacerItem(197, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.label = QtWidgets.QLabel(dialog)
        self.label.setObjectName("label")
        self.horizontalLayout.addWidget(self.label)
        spacerItem1 = QtWidgets.QSpacerItem(197, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem1)

        self.movie = QMovie("ajax-loader.gif")
        self.label.setText("")
        self.label.setMovie(self.movie)
        #self.label.setScaledContents(True)
        self.movie.start()

        self.label.resize(220,19)
        

        self.retranslateUi(dialog)
        QtCore.QMetaObject.connectSlotsByName(dialog)

    def retranslateUi(self, dialog):
        _translate = QtCore.QCoreApplication.translate
        dialog.setWindowTitle(_translate("dialog", "Εισαγωγή αρχείου ήχου"))
        #self.label.setText(_translate("dialog", "123456789101112131415"))
#import main_icons_rc


if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    dialog = QtWidgets.QDialog()
    ui = Ui_dialog()
    ui.setupUi(dialog)
    dialog.show()
    sys.exit(app.exec_())

上面的代码在 ubuntu 20.04 中工作,但在 Windows 10 中没有出现任何东西(只是窗口,带有标题和?,X 按钮)。

在 Ubuntu 我有 python3.6 在 Windows 10 我有 python3.8

怎么了?

4

1 回答 1

-1
if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    app.addLibraryPath(r"C:\Users\Χρήστος\AppData\Local\Programs\Python\Python38\Lib\site-packages\pyqt5_tools\Qt\plugins")
    dialog = QtWidgets.QDialog()
    ui = Ui_dialog()
    ui.setupUi(dialog)
    dialog.show()
    sys.exit(app.exec_())

我必须导入图像库才能工作!!!

于 2020-09-29T22:45:52.030 回答