Aug 2010
1 / 5
Aug 2010
Sep 2010

Hi Guys,

I have been following through these tutorial regarding QT and Maya;

http://animateshmanimate.com/2010/07/19/maya-and-qt-tutorial/23
https://www.creativecrash.com/maya/tutorials/scripting/mel/c/using-qt-designer-for-mel-interfaces21

I am porting the instructions into python edit - pyMel, naturally as I go, and all is well except;

I cannot get the push button widget to run a command.

In Mel; you add dynamic property to the budget called -c (for button() command flag), and then in the string field you enter your command.

In Python, I am not sure... I have tried the following, with no error, but no result;
(dynamic property, command)

command = , print "Foo"
command , = print "Foo"
command, print "Foo"
command, (print "Foo")

No Potato. Any advice would be appreciated :slight_smile:

Thanks Guys!

  • created

    Aug '10
  • last reply

    Sep '10
  • 4

    replies

  • 4.9k

    views

  • 1

    user

  • 4

    links

While I'm THRILLED that you're looking at that tutorial, I have to tell you that, while that tutorial is wonderful for Mel scripting, it simply will not work for Python. This is for a few reasons: A) It wont work (as you've already seen); B) Autodesk is still figuring out how they're implementing QT; and C) Because of that some functions don't work (no integer fields and spotty documentation). You COULD use it as a basis if you were going to layer pyQT or something else on top of it, but in the end, you're probably going to be better off creating your ui in Mel (via python) or pyQT (or one of the other QT options out there). There's a thread here7 that talks about python and pyQT. You might find some help with that.

When I wrote that tutorial, my focus was mainly on getting a working interface with Mel, because at the time I didn't know python. I've been writing things in Python now, but haven't made a UI for it yet, but once I do, I'll post a write up on my site about that as well. It'll be a few weeks before that happens though, so if what you're doing is time sensitive, I'd go look at the pyQT stuff. HTH.

You might check this post out as well.16

Thanks a tonne John,

Biggsy, the mel-guru here suggested that may be the case. Halfway implementation again :frowning: oh well.

I will go the old school route I think, as I want to share my tool here so want to keep stuff within the capabilities of default maya install if possible :). Maybe I'll make a pyQT version for internal use, just for learning sake.

Thanks heaps for the further reading too

all the best,

Chris Dardis

I think one of the bigest problems is that the pyQT licence is what it is, that means maya can NOT SHIP pyqt even if they wanted to, so youd have to manually do it in all cases. I mean somebody OTHER than autodesk could make it easy but not autodesk.

This said nokia is porting qt with similliar interface to python, but this library is half finished and humongously bloated. This essentially means autodesk must provide the interfaces, which will be quite limitted because i doubt they have the willingness to pour money into this.

No problem DrDardis. Glad I was able to help, albeit I would have like it if the tutorial would have been enough - I'll yell at the guy that wrote it later. :slight_smile:

@Joojaa - I hear you on having to package things for Maya if you want to distribute it. :confused: I'm doing some stuff with Math and so I'm using NumPy since it is far quicker in calculating than the stock Pyton Math module and it comes down to having to include a download for each and every OS and Architecture in the script if I want to distribute it. That takes a 16 kb script to a 60 mb download. At that point it doesn't seem worth distributing it.