To create a floating window in Maya using Python, you can use the `cmds` module. To make it look like a fancy window, you might want to customize the appearance using styles and colors.
Here's an example code to create a basic floating window:
---->
import maya.cmds as cmds
def create_window():
window_name = "Window"
if cmds.window(window_name, exists=True):
cmds.deleteUI(window_name, window=True)
window = cmds.window(window_name, title="Window", widthHeight=(300, 150))
cmds.columnLayout(adjustableColumn=True)
cmds.text(label="This is a window", align="center", font="boldLabelFont")
cmds.button(label="Close", command=('cmds.deleteUI("' + window_name + '", window=True)'))
cmds.button(label="Press Me", command=show_message)
cmds.showWindow(window)
def show_message(*args):
cmds.confirmDialog(title='Message', message='It works!', button=['OK'], defaultButton='OK')
create_window()<----
This code defines a function `create_window()` that creates a Maya window with a title "Window", a label, and a button to close the window. You can customize this code to add more elements and style them according to your requirements.
