【QT】Pycharm add QT Desinger

时间:2024-01-19 19:12:50

1.

【QT】Pycharm add QT Desinger

https://www.cnblogs.com/dalanjing/p/6978373.html

【QT】Pycharm add QT Desinger

【QT】Pycharm add QT Desinger

-m PyQt5.uic.pyuic  $FileName$ -o $FileNameWithoutExtension$.py

2.

通过以下快速跳到 QtDesinger里

【QT】Pycharm add QT Desinger

随便设置一下,并保存到该项目路径中,会以.ui的文件方式保存。

3.通过对t1.ui 使用转换,可以生成t1.py

【QT】Pycharm add QT Desinger

4.

将里边的3个语句注释掉

# MainWindow.setCentralWidget(self.centralwidget)
# MainWindow.setMenuBar(self.menubar)
# MainWindow.setStatusBar(self.statusbar)

并添加
if __name__=="__main__":
import sys
app=QtWidgets.QApplication(sys.argv)
widget=QtWidgets.QWidget()
ui=Ui_MainWindow()
ui.setupUi(widget)
widget.show()
sys.exit(app.exec_()) 即可正常执行 https://blog.csdn.net/lyzwjaa/article/details/79429901
https://blog.csdn.net/qq_40666028/article/details/81069878
https://jingyan.baidu.com/article/5553fa8298b99c65a23934dd.html
Collecting pyqt5-tools

  Could not find a version that satisfies the requirement pyqt5-tools (from versions: )
No matching distribution found for pyqt5-tools

没办法,想要解决这个问题,先在网上找找答案吧!在google下搜到了这个答案

【QT】Pycharm add QT Desinger

到此,明白了为啥安装失败,原因是pyqt5-tools还没有mac版的,目前只提供了windows版本