#!/usr/bin/python3

"""
Just a popup that says "Hello World!".

To install dependencies on linux:
    $ sudo /usr/bin/python3 -m pip install PySide2

Derived from https://gist.github.com/zed/b0576dcd90f0edd91f30
"""

import sys
from PySide2.QtWidgets import QApplication, QLabel, QWidget, QPushButton, QVBoxLayout


def on_button_click():
    """Exit when button is clicked."""
    sys.exit(0)


# Create a Qt application
application = QApplication(sys.argv)

# Create a Qt window
window = QWidget()

# Create a Label
label = QLabel('Hello World!')

# Create a button and connect it to a callback
button = QPushButton('exit')
button.clicked.connect(on_button_click)

# Create a vertical layout for the label and button
layout = QVBoxLayout()

# Add the label and button vertically
layout.addWidget(label)
layout.addWidget(button)

window.setLayout(layout)

window.show()

# Enter Qt application main loop
application.exec_()
sys.exit()