# Introduction to Qt - demonstrating signals
# by Anthony Vogelaar, Perth Scotland
# rev 0.10  2024-03-31  Initial release

import  os;             os.system('clear')
from    PySide6.QtCore  import  QObject
import  time

# ================================== GUI =========================================

def printHello():                               # used as slot
    print('Hello')
    print(obj.objectName())

# ================================ Main ==========================================

def main():
    global  obj

    obj = QObject()                        
    obj.objectNameChanged.connect(printHello)   # using signal objectNameChanged
    print('sleep for 2 seconds')
    time.sleep(2)
    obj.setObjectName("it's me")


main()

# ================================= End ==========================================
