if I run the following code in a python tab of the script editor:
import maya.cmds as cmds
class winTest(object):
def __init__(self):
self.windowTitle = 'This is my class window'
self.WindowHandle = cmds.window(title=self.windowTitle,
maximizeButton=False, widthHeight=(300,300))
cmds.showWindow(self.WindowHandle)
winTest()
the window which is created is shown as "window1" on the taskbar
(linux). Is this different behaviour from what you are
experiencing ? If so, are you on linux ? Maya 2010 ? I am just
wondering what if this is a bug in python in maya. When I run
essentially the same code in mel, I get the title displayed properly
on the taskbar.
thanks
-G
On Jan 17, 1:13 pm, damon shelton <[email protected]> wrote:
> fpr the window title in mel you pass a string "myWidowTitle"
> in python you are passing an argument self.windowTitle
>
> is self.windowTitle set as "myWindowTitle"??
> eg.
> self.windowTitle = 'myWindowTitle'
> self.WindowHandle = cmds.window(title=self.windowTitle,
> maximizeButton=False, widthHeight=(300,300))
>
> if you pass an empty string into the title slot maya will automatically name
> the title with the window name
>
> if your question is about the window naming as well then read on::
>
> in your mel example you pass a string called myFunction at the end. so I am
> assuming your window was called myFunction
> call your python like this:
> self.windowTitle = 'myWindowTitle'
> self.WindowHandle = cmds.window('myFunction', title=self.windowTitle,
> maximizeButton=False, widthHeight=(300,300))
>
> in MEL when you name a ui control you put it's name at the end
> in python, since name is not a keyword argument you have to put it first in
> your arguments followed by your keyword args
>
> On Mon, Jan 17, 2011 at 8:39 AM, ranxerox <[email protected]> wrote:
>
> > maya 2010, linux. I ran your code and it gave me the same problem as
> > mine. The actual name of the window on the taskbar is 'window1',
> > when it is created via mel the window title is displayed correctly on
> > the taskbar.
>
> > -G
>
> > On Jan 14, 7:15 pm, Seth Gibson <[email protected]> wrote:
> > > Can you give a bit more context? I tried this:
>
> > > import maya.cmds as cmds
>
> > > class winTest(object):
>
> > > def __init__(self):
>
> > > self.windowTitle = 'This is my class window'
>
> > > self.WindowHandle = cmds.window(title=self.windowTitle,
> > > maximizeButton=False, widthHeight=(300,300))
>
> > > cmds.showWindow(self.WindowHandle)
>
> > > and it works fine.
>
> > > On Fri, Jan 14, 2011 at 11:51 AM, ranxerox <[email protected]>
> > wrote:
>
> > > > hey all, I just noticed an annoying behaviour and was wondering if
> > there
> > > > was a solution. I have 2 scripts which I wrote, 1 mel, 1 python. To
> > create
> > > > the main window in mel I use this:
>
> > > > window -title "myWindowTitle" -wh 400 300 -mxb false myFunction;
>
> > > > to create the window in python I use this:
>
> > > > self.WindowHandle = cmds.window(title=self.windowTitle,
> > > > maximizeButton=False, widthHeight=(300,300))
>
> > > > the window title for the python script is listed as 'window1', the
> > window
> > > > title for the mel script is listed correctly as 'myWindowTitle'... is
> > there
> > > > something I'm missing here or is this functionality missing from the
> > python
> > > > side of things.
>
> > > > thanks
>
> > > > -G
>
> > > > --
> > > >http://groups.google.com/group/python_inside_maya
>
> > --
> >http://groups.google.com/group/python_inside_maya
>
>
--
http://groups.google.com/group/python_inside_maya