Waiting for Windows

David Woods wrote:

Hello.

I am writing a program that allows researchers to manipulate video data, and
have run into a problem on Win32.

I need to load video into the media player component and then move to the
appropriate position in the video. The problem I have is that I can't
change the video position until Windows has finished loading the video. How
can I tell when this is done?

I don't know. You can probably get access to the media player via COM and query it directly...

So far, the only solution I've been able to get working in wxPython is to
issue a wxSleep(1) command, which is inelegant, to say the least. I know
there must be a better way.

A better way to "wait a bit" and then do something is to use wxCallAfter, just pass it a callable object and parameters and then it will be called after any pending events are handled. If you want to wait a specific amount of time first then use a wxTimer.

In Delphi, I would issue an "Application.ProcessMessages;" command, and all
would be well. I see that wxApp has a ProcessMessage method, which seems
like it might be the function I'm looking for, but I can't seem to figure
out how to call it, and I can't find anything helpful in the list archives
or in any of the other places I've looked.

I don't know Delphi but I would guess from the name that "Application.ProcessMessages;" is more like calling wxApp's Yield method. (wxYield() is an alias.)

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin and Jimmy,

Thanks for the helpful feedback. wxCallAfter does not work in this
instance; I'm guessing that the media player's events are completed before
the video is completely loaded. wxYield didn't work either. However, I
have figured out how to query the media player to tell when it is done
loading, so I should be able to figure it out from here.

David

···

-----Original Message-----
From: Robin Dunn [mailto:robin@alldunn.com]
Sent: Wednesday, January 15, 2003 3:06 PM
To: wxPython-users@lists.wxwindows.org
Subject: Re: [wxPython-users] Waiting for Windows

David Woods wrote:

Hello.

I am writing a program that allows researchers to manipulate video data,

and

have run into a problem on Win32.

I need to load video into the media player component and then move to the
appropriate position in the video. The problem I have is that I can't
change the video position until Windows has finished loading the video.

How

can I tell when this is done?

I don't know. You can probably get access to the media player via COM
and query it directly...

So far, the only solution I've been able to get working in wxPython is to
issue a wxSleep(1) command, which is inelegant, to say the least. I know
there must be a better way.

A better way to "wait a bit" and then do something is to use
wxCallAfter, just pass it a callable object and parameters and then it
will be called after any pending events are handled. If you want to
wait a specific amount of time first then use a wxTimer.

In Delphi, I would issue an "Application.ProcessMessages;" command, and

all

would be well. I see that wxApp has a ProcessMessage method, which seems
like it might be the function I'm looking for, but I can't seem to figure
out how to call it, and I can't find anything helpful in the list archives
or in any of the other places I've looked.

I don't know Delphi but I would guess from the name that
"Application.ProcessMessages;" is more like calling wxApp's Yield
method. (wxYield() is an alias.)

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org