textField - invoking callback on each keypress, keeping focus after Enter

66 views
Skip to first unread message

Michał Frątczak

unread,
Aug 24, 2016, 7:43:46 AM8/24/16
to Python Programming for Autodesk Maya
Hi
I'm using textField to implement interactive filter to some list of strings.
I'd like to have my callback function being called on each keypress.
Also, I'd like to retain focus after enter.

I'm with MEL now but can convert to anything that works:

textField -e -cc "myCallback" $textField UI;


thanks !

Justin Israel

unread,
Aug 24, 2016, 3:59:20 PM8/24/16
to Python Programming for Autodesk Maya

Hi

If the change callback doesn't fire on each keypress (I can't remember) and you want more custom behaviour than the limited Maya UI objects provide, then you may need to switch to PySide. You can make a QLineEdit do anything you want.

Justin


--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/b83bb3c3-f4ce-4b85-99fc-e43d1e578108%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alok Gandhi

unread,
Aug 24, 2016, 9:16:31 PM8/24/16
to python_in...@googlegroups.com
+1 for QLineEdit

On Thu, Aug 25, 2016 at 3:59 AM, Justin Israel <justin...@gmail.com> wrote:

Hi

If the change callback doesn't fire on each keypress (I can't remember) and you want more custom behaviour than the limited Maya UI objects provide, then you may need to switch to PySide. You can make a QLineEdit do anything you want.

Justin


On Wed, 24 Aug 2016, 11:43 PM Michał Frątczak <f.mi...@gmail.com> wrote:
Hi
I'm using textField to implement interactive filter to some list of strings.
I'd like to have my callback function being called on each keypress.
Also, I'd like to retain focus after enter.

I'm with MEL now but can convert to anything that works:

textField -e -cc "myCallback" $textField UI;


thanks !

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1Qe3ejJ6ACu%2BjCKimZnscZq8tV7v2Cm%2Bc3ng1c7A-cSg%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.



--

Benjam901

unread,
Aug 25, 2016, 7:24:39 AM8/25/16
to Python Programming for Autodesk Maya
Yeah I am also with Justin on PySide and QLineEdit.

You can listen for signals like textChanged, enterPressed, stoppedEditing etc. and then call a function when these are fired. I use QLineEdit for filtering all the time, works a treat :)

f.michal

unread,
Aug 25, 2016, 8:05:50 AM8/25/16
to python_in...@googlegroups.com
Thanks guys !
I kept away from Qt for too long now, partly because complicated setup on c++ side and partly because MEL was enough most time...
It's also good time to check Marcus and Fredrik's  Qt.py tool :) so, do you know of any nice maya+qt tutorials/recipes ?

thanks !

W dniu 2016-08-25 o 13:24, Benjam901 pisze:
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/71269d8c-4102-495b-bf04-ec84fea0e771%40googlegroups.com.

Marcus Ottosson

unread,
Aug 25, 2016, 8:32:41 AM8/25/16
to python_in...@googlegroups.com
Whenever anyone asks about getting started with PyQt, this book always pops up. It covers a lot of PyQt4, which is all relevant in PyQt5 too.


What it doesn't cover is what PyQt5 *added*, namely QML, for which a complementary guide can be found here.


There are also a few video series on Youtube about QML which some Googling will be able to reveal.

Best,
Marcus
Reply all
Reply to author
Forward
0 new messages