def add_photo(self):
""" Function called to add a photo. Open a QFileDialog and fill
self.photo with the selected image
"""
self.photo_selected = QtWidgets.QFileDialog(self).getOpenFileUrl(
self, "Selectionnez une image", settings.IMG_BASE_DIR,
"Image Files (*.png *.jpg *.bmp)")[0].path()
if self.photo_selected:
image = QtGui.QPixmap(self.photo_selected)
if not image.isNull():
self.photo.setPixmap(image.scaled(QtCore.QSize(120, 160)))
self.on_change()
评论列表
文章目录