[python-win32] windows text rendering question

Boris Borcic bborcic at gmail.com
Tue Jan 23 16:25:11 CET 2007


Hello,

I am trying to use UI Automation to drive an MS Windows app with pywinauto.

I need to scrape the app's window contents and use some form of OCR to get at
the texts (pywinauto can't get at them).

As an alternative to integrating an OCR engine, and since I know the fonts and
sizes used to write on the app's windows, I reasoned that I could base a simple
text recognition module on the capability to drive MSWindows text rendering - eg
to generate pixmaps of texts I expect to find in the driven app's windows, exact
to the pixel.

The advantage of that approach would be exactitude and self-containment.

I've verified manually inside an Idle window, that indeed I could produce
pixmaps of expected app texts, exact to the pixel (with Tkinter+screen capture
at least).

I could use help to turn this into a programmable capability, ie : does anyone
here know of a simple - with Tkinter or otherwise - way to wrap access to the MS
Windows UI text rendering engine, as a function that would return a picture of
rendered text, given a string, a font, a size and colors ?

And ideally, without interfering with screen contents ?

Thanks in advance for any guidance,

Boris Borcic



More information about the Python-win32 mailing list