Hi!
Ive had trouble doing a -select -r command for a UI window I made that launches other windows that steal its focus so that i can kill the window without manually pressing the X in the menu bar. I also cant successfully run a command that should close the window if its currently open UNLESS the window is
active. I want to be able to close the window at any time, regardless of what window is active. I've done things like list all windows with lsUI -windows but that doesnt work.
I've been trying to find a way to keep focus on the window so that I can destroy it when I release the key (F1). I havent found an easy way to do this yet. I tried making a class and using UIC but it became an enormous headache and my buttons didnt come through and neither did my background.
[vv]39745659[/vv]
Note: this is mapped to F1 and the release command destroys it but unfortunately only works if it has focus
- import maya.cmds as cmds
- import sip
- from PyQt4 import QtGui, QtCore
-
- if cmds.window('LaunchyWin1', q=True, exists=True):
- cmds.deleteUI(LaunchyWin1)
-
- Launcher1 = cmds.loadUI (f='C:/Users/aleks/Desktop/PyQt proj/UI/ScriptLauncher1addBG.ui')
-
- pos = QtGui.QCursor.pos()
- cmds.showWindow(Launcher1)
-
- cmds.window('LaunchyWin1', e=True, tlc=[pos.y(), pos.x()])