Checking the clipboard

Hey all,
I was wondering how I could check the clipboard and see if it is either empty or has something copied to it other than text (such as an image or file). If I could do this through a platform-independent method, that would be great (if not, could you show me how to do it on windows, linux, and mac?)

Also, what is the function to see if some text is highlighted? And what’s the function for moving the cursor to the end of a line?
(I’m starting to sound like a leecher…)

Thanks so much for any help. It would also help if you can show me some documentation.

Trey

Trey,

From: Trey K [mailto:trey.wxpython@gmail.com]
Sent: Monday, October 15, 2007 6:31 PM
To: wxPython-users@lists.wxwidgets.org
Subject: Checking the clipboard

Hey all,
I was wondering how I could check the clipboard and see if it
is either empty or has something copied to it other than text
(such as an image or file). If I could do this through a
platform-independent method, that would be great (if not,
could you show me how to do it on windows, linux, and mac?)
Also, what is the function to see if some text is
highlighted? And what's the function for moving the cursor to
the end of a line?
(I'm starting to sound like a leecher...)

Thanks so much for any help. It would also help if you can
show me some documentation.

Trey

What widget are your using (or planning to use)? I'm not aware of a
cross-platform way to get at the clipboard. I do know how to get at the
Windows version though. You'll need the pyWin32 package. Then check out
this link:

http://snippets.dzone.com/posts/show/724

Oh...by the way: Google is your friend! I googled and found this for the
Mac:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/410615

And here's a "pure python" implementation:

http://discussion.forum.nokia.com/forum/showthread.php?t=117567

Mike

···

-----Original Message-----

Hey all,
I was wondering how I could check the clipboard and see if it
is either empty or has something copied to it other than text
(such as an image or file). If I could do this through a
platform-independent method, that would be great (if not,
could you show me how to do it on windows, linux, and mac?)
Also, what is the function to see if some text is
highlighted? And what's the function for moving the cursor to
the end of a line?
(I'm starting to sound like a leecher...)

Thanks so much for any help. It would also help if you can
show me some documentation.

Trey

What widget are your using (or planning to use)? I'm not aware of a
cross-platform way to get at the clipboard. I do know how to get at the
Windows version though. You'll need the pyWin32 package. Then check out
this link:

http://snippets.dzone.com/posts/show/724

Oh...by the way: Google is your friend! I googled and found this for the
Mac:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/410615

And here's a "pure python" implementation:

http://discussion.forum.nokia.com/forum/showthread.php?t=117567

Mike

Get the "Docs and Demos" download off the wxPython web site. It includes the wxWidgets reference document, which are mostly written for C++ but works well enough for wxPython as well, as there are wxPython-specific comments embedded where needed. Search the wxWidgets document's index for wxClipboard. It's a nice cross-platform solution.

David

Robin's book, chapter 18, has five full pages on the use of wx.TheClipboard. wx.TheClipboard can handle any wx.DataObject instance.

Bob

···

At 07:31 PM 10/15/2007, Trey K wrote:

Hey all,
I was wondering how I could check the clipboard and see if it is either empty or has something copied to it other than text (such as an image or file). If I could do this through a platform-independent method, that would be great (if not, could you show me how to do it on windows, linux, and mac?)

Trey K wrote:

Also, what is the function to see if some text is highlighted? And what's the function for moving the cursor to the end of a line?

If you're talking about a wx.TextCtrl then take a look at the docs for its methods. All you'll need is there.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!