<< Click to Display Table of Contents >> Events Generated by the Python Control |
![]() ![]() ![]() |
The Python VPE Control fires several events to your application, so you have control about what's happening.
Event handlers are implemented as methods in the class VpeControl(). To override an event handler, derive your own class from VpeControl() and override the desired event handler method.
Example:
import os, sys
from time import sleep
from VpeControl import *
class MyVpeControl(VpeControl):
def RequestClose(self):
print("MyVpeControl: RequestClose() is called")
return 0
doc = MyVpeControl()
doc.OpenDoc()
doc.Print(1, 1, "Hello World!")
doc.WriteDoc("hello world.pdf")
# 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)
In the above example, the event handler RequestClose() is called, when you close the preview window.
On the following pages you will find a complete list of events generated by VPE.