ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-win32
python-win32
Re: [python-win32] System wide text selection
by Tim Roberts other posts by this author
Apr 18 2006 10:14AM messages near this date
[python-win32] System wide text selection | Re: [python-win32] System wide text selection
On Mon, 17 Apr 2006 19:54:14 +0200, Dao Duy Huy <dao@[...].de>  wrote:

> I'm  writing  a dictionary german <> vietnamese for free use, which
> should react on the mouse-click like babylon.
> You click on a german word in any win-program and the dict program will 
> show you the translation in vietnamese and vice versa.
> 
> But i couldn't find the way how i can select the word with the mouse
> position...
> 
> Can you show me how you solve the problem?
> 


This is a difficult problem to solve, and it may be that Python is not
the right language for it.

You first have to figure out which window contains the point you want. 
Then, you have to figure out what KIND of window that is (text box, rich
text control, static text, list box, custom control).  Then, you use
THAT knowledge to decide how to ask the control to translate the X,Y
coordinate into a row and column position.  Then, you can fetch the
whole contents of that window, find the exact character, and work
backwards and forwards to find the word boundaries.  Note that for some
applications (like Word), you will have to use Word APIs to do this.

It is complicted.  You will want to do a lot of web searching to see if
you can find some good sample code.

-- 
Tim Roberts, timr@[...].com
Providenza & Boekelheide, Inc.

_______________________________________________
Python-win32 mailing list
Python-win32@[...].org
http://mail.python.org/mailman/listinfo/python-win32
Thread:
Dao Duy Huy
Tim Roberts
Mark Mc Mahon

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved