Skip to content

Instantly share code, notes, and snippets.

@taikomatsu
Created April 10, 2017 10:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taikomatsu/c8ec6227c4b4e91c5177ede093816fe2 to your computer and use it in GitHub Desktop.
Save taikomatsu/c8ec6227c4b4e91c5177ede093816fe2 to your computer and use it in GitHub Desktop.
H16 PySide2 easy example
import hou
from PySide2 import QtWidgets
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.construct_ui()
def construct_ui(self):
self.setWindowTitle('PySide2 Test')
# match look & feel to H16
self.setStyleSheet(hou.qt.styleSheet())
self.setProperty("houdiniStyle", True)
# main widget
main_widget = QtWidgets.QWidget(self)
self.setCentralWidget(main_widget)
# layout initialize
g_layout = QtWidgets.QVBoxLayout()
layout = QtWidgets.QFormLayout()
main_widget.setLayout(g_layout)
# Add Widgets
self.parm = QtWidgets.QSpinBox()
self.parm.setValue(30)
layout.addRow('Parameter', self.parm)
self.exec_btn = QtWidgets.QPushButton('Execute')
# global layout setting
g_layout.addLayout(layout)
g_layout.addWidget(self.exec_btn)
w = MainWindow()
w.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment