Mayavi Animate: UI Question

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Mayavi Animate: UI Question

Chiping Yeh
Hello,
     When I try to set the ui parameter of the animate decorate to false, the entire animation doesn't run. I saw a posting of the same problem online, and the advice was to add the mlab.show decorator, but that doesn't work with my Qt application: the error "QCoreApplication::exec: The event loop is already running" appears. I tried creating a pyface Timer but I could not get it to work (no matter what I did, it only ran once). Is there any other way to get rid of the animate ui? I feel that this issue may be a bug...

Thanks,
Chiping Yeh

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Mayavi Animate: UI Question

Gael Varoquaux
On Wed, Jul 10, 2013 at 10:39:34PM -0400, Chiping Yeh wrote:
>      When I try to set the ui parameter of the animate decorate to false, the
> entire animation doesn't run. I saw a posting of the same problem online, and
> the advice was to add the mlab.show decorator, but that doesn't work with my Qt
> application: the error "QCoreApplication::exec: The event loop is already
> running" appears. I tried creating a pyface Timer but I could not get it to
> work (no matter what I did, it only ran once). Is there any other way to get
> rid of the animate ui? I feel that this issue may be a bug...

With this description, it is pretty hard to figure what is going on.
Chances are that many aspects of the environment are relevant. If you
want more help, it would be good if you could produce a minimal example
reproducing the problem.

My hunch is that you are running a Wx code in a Qt application, and that
setting 'ui=True' create a Wx application. Another option might be that
you haven't started the Qt event loop.

HTH,

G
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Mayavi Animate: UI Question

Chiping Yeh
Hello,
    I have attached a small example illustrating the problem I am having. I simply took the embedding in Qt example and inserted the first animating example here into it, calling the animation function through an added button. Running it as it is will generate the error, and removing the @mlab.show will not generate the error but simply not run the animation. Setting ui=True without @mlab.show will cause it to animate as expected. I hope this can help in understanding my issue.

Sincerely,
Chiping Yeh


On Thu, Jul 11, 2013 at 12:37 AM, Gael Varoquaux <[hidden email]> wrote:
On Wed, Jul 10, 2013 at 10:39:34PM -0400, Chiping Yeh wrote:
>      When I try to set the ui parameter of the animate decorate to false, the
> entire animation doesn't run. I saw a posting of the same problem online, and
> the advice was to add the mlab.show decorator, but that doesn't work with my Qt
> application: the error "QCoreApplication::exec: The event loop is already
> running" appears. I tried creating a pyface Timer but I could not get it to
> work (no matter what I did, it only ran once). Is there any other way to get
> rid of the animate ui? I feel that this issue may be a bug...

With this description, it is pretty hard to figure what is going on.
Chances are that many aspects of the environment are relevant. If you
want more help, it would be good if you could produce a minimal example
reproducing the problem.

My hunch is that you are running a Wx code in a Qt application, and that
setting 'ui=True' create a Wx application. Another option might be that
you haven't started the Qt event loop.

HTH,

G
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev

qt_embedding(1).py (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Mayavi Animate: UI Question

Gael Varoquaux
Hi Chiping,

I can indeed reproduce your problem. It appears that, when called in a
button callback, the timer does not fire by itself. I suspect a problem
of scope and of event loops. I haven't found an easy fix.

I guess that this is the limitation of providing high-level abstractions
that try to hide the difficulty of GUI programming. At some point they
break down, and you have to bite the bullet and code real pyface (or Qt)
code. Managing the timer yourself and the event loop should enable you to
workaround the problem.

Cheers,

Gaël

On Thu, Jul 11, 2013 at 01:20:38AM -0400, Chiping Yeh wrote:
> Hello,
>     I have attached a small example illustrating the problem I am having. I
> simply took the embedding in Qt example and inserted the first animating
> example here into it, calling the animation function through an added button.
> Running it as it is will generate the error, and removing the @mlab.show will
> not generate the error but simply not run the animation. Setting ui=True
> without @mlab.show will cause it to animate as expected. I hope this can help
> in understanding my issue.

> Sincerely,
> Chiping Yeh


> On Thu, Jul 11, 2013 at 12:37 AM, Gael Varoquaux <[hidden email]
> > wrote:

>     On Wed, Jul 10, 2013 at 10:39:34PM -0400, Chiping Yeh wrote:
>     >      When I try to set the ui parameter of the animate decorate to false,
>     the
>     > entire animation doesn't run. I saw a posting of the same problem online,
>     and
>     > the advice was to add the mlab.show decorator, but that doesn't work with
>     my Qt
>     > application: the error "QCoreApplication::exec: The event loop is already
>     > running" appears. I tried creating a pyface Timer but I could not get it
>     to
>     > work (no matter what I did, it only ran once). Is there any other way to
>     get
>     > rid of the animate ui? I feel that this issue may be a bug...

>     With this description, it is pretty hard to figure what is going on.
>     Chances are that many aspects of the environment are relevant. If you
>     want more help, it would be good if you could produce a minimal example
>     reproducing the problem.

>     My hunch is that you are running a Wx code in a Qt application, and that
>     setting 'ui=True' create a Wx application. Another option might be that
>     you haven't started the Qt event loop.

>     HTH,

>     G
>     _______________________________________________
>     Enthought-Dev mailing list
>     [hidden email]
>     https://mail.enthought.com/mailman/listinfo/enthought-dev




> _______________________________________________
> Enthought-Dev mailing list
> [hidden email]
> https://mail.enthought.com/mailman/listinfo/enthought-dev


--
    Gael Varoquaux
    Researcher, INRIA Parietal
    Laboratoire de Neuro-Imagerie Assistee par Ordinateur
    NeuroSpin/CEA Saclay , Bat 145, 91191 Gif-sur-Yvette France
    Phone:  ++ 33-1-69-08-79-68
    http://gael-varoquaux.info            http://twitter.com/GaelVaroquaux
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev