#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys, os
from PySide2.QtWidgets import*
from PySide2.QtGui import*
from PySide2 import QtCore

def quit_app():
    global application
    print("Quit!")
    application.exit()

def get_img_path():
    here = os.path.dirname(os.path.abspath(__file__))
    parent = os.path.dirname(here)
    return os.path.join(parent, 'res', 'img.png')

application = QApplication(sys.argv)
window = QWidget()
window.setWindowTitle("QPixmap")

button = QPushButton("Quit", window)
button.clicked.connect(quit_app)

picture = QPixmap(get_img_path())

label = QLabel(window)
label.setPixmap(picture)
label.setGeometry(QtCore.QRect(10, 40, picture.width(), picture.height()))

window.resize(max(picture.width()+20, 160), max(picture.height()+100, 120))
window.show()

sys.exit(application.exec_())
