Porting from PyQt5 to PySide2

in «Programming» by Gianluca
Tags: , ,

After some years, I finally decide to port some (if not all, given time) my Python project from PyQt4 to PySide2.

The reason is that now PySide2 is the official port while some years ago PyQt was a better choice.

The first, just because is much more simple than the others, is Vtf, which is a little tool to calculate the cutting speed for machine tools. given the number of teeth, the feed rate and few other tools parameters, it calculate the machine paramenter you can use.

Anyway, porting from PyQt5 to PySide2 was really simple: just modify the imports

from PyQt5 import QtGui, QtCore, QtWidgets
from PySide2.QtWidgets import QApplication
from PySide2.QtWidgets import QLabel
from PySide2.QtWidgets import QDialog

and correct the code accordingly and the program run like before.

Then since Vtf use a .ui file for the gui and there is a Makefile to call the uic equivalent for Python, so in the Makefile I just swapper the relevant command from pyuic5 to pyside2-uic.

That's all, at least for this project.
As soon as I will port my other projects, maybe I will find some other tips or problem to port the code. I will see.


blog comments powered by Disqus