1

I have created a UI that can be launched inside Maya. My class for this window inherits from QDialog. I want to have a button that will open a jpg into a new window, and then it closes with another button. While this other window is open I would like to still be able to interact with the main window. Is it possible to do this? How would I go about launching this new window?

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
ghost654
  • 161
  • 2
  • 18

1 Answers1

1

You can use this code to get what you want. I tested it in Maya 2016.5 on macOS. Works fine!

import maya.cmds as cmds

def loadSecondWindow(*args):
    window = cmds.window()
    cmds.paneLayout()
    cmds.image(image='/Users/swift/Desktop/scientist01.jpg')
    cmds.showWindow(window)

def deleteSecondWindow(*args):  
    if (cmds.window('window2', exists=True)):
        cmds.deleteUI('window2')  

cmds.window(width=200)
cmds.columnLayout(adjustableColumn=True)
cmds.button(label='Window with Picture', command=loadSecondWindow)
cmds.button(label='Delete Window', command=deleteSecondWindow)
cmds.showWindow()

enter image description here

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220