Skip to main content

Hello World dialog example

Create a hello_world_dialog.py file inside your user extensions folder with the following content:


from PySide2 import QtWidgets

from ftrack_framework_qt.dialogs import BaseDialog

class HelloWorldDialog(BaseDialog):

name = "hello_world_dialog"
ui_type = 'qt'

def __init__(
self,
event_manager,
client_id,
connect_methods_callback,
connect_setter_property_callback,
connect_getter_property_callback,
dialog_options,
parent=None,
):
super(HelloWorldDialog, self).__init__(
event_manager,
client_id,
connect_methods_callback,
connect_setter_property_callback,
connect_getter_property_callback,
dialog_options,
parent=parent,
)

self.setWindowTitle("Hello World")
self.resize(400, 200)

def pre_build_ui(self):
layout = QtWidgets.QVBoxLayout()
self.setLayout(layout)

def build_ui(self):

label = QtWidgets.QLabel("Hello World")
self.layout().addWidget(label)

self._button = QtWidgets.QPushButton("Close")
self.layout().addWidget(self._button)

def post_build_ui(self):
self._button.clicked.connect(self.close)