Rendering text question (context is MSWin UI Automation)
arkanes at gmail.com
Tue Jan 23 15:13:55 EST 2007
On 23 Jan 2007 12:06:35 -0800, imageguy <imageguy1206 at gmail.com> wrote:
> > 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 : 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
> I was looking for ( and still am searching for) similiar functionality.
> Specifically I would like to be able to capture a small area of the
> screen (a number or a code) and convert this to text that can be used
> in my application.
> When I asked my question, I was directed to the Microsoft Accessibility
> tool kit.
> Serach on this list for the post titled;
> "Reading text labels from a Win32 window"
> I work with wxPython and Win32 applications exclusively.
> So if I can be of any help or assistance, please let me know.
The OP stated that pywinauto couldn't get at the text, so it's
probably drawn directly with GDI methods rather than being a static
text control. The accessibility toolkit only works if it's a static
text control or the application goes to some lengths to expose the
text to screen readers.
More information about the Python-list