Multiple Previews

<< Click to Display Table of Contents >>

Navigation:  How To Use the VPE Control > VPE Python >

Multiple Previews

Previous pageReturn to chapter overviewNext page

Because Python is windowless, you need to pump Windows messages to the preview:

# Note that the DispatchAllMessages()-loop is required to pump messages from the

# Windows operating system to the preview. This keeps the preview alive.

doc.Preview()

abort = False

while not abort:

 abort = doc.DispatchAllMessages()

 sleep(0.01)

 

If you want to show multiple previews at the same time, each document must be created within its own thread, ending in the above message pump. You can not put only the message pump into a thread, because the Windows operating system only dispatches messages for windows that have been created within the same thread in which the message pump is running. So as a result, the whole VPE document must be created within the same thread, including the message pump.