473,657 Members | 2,528 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

wxTheClipboard problem, IDLE vs PythonWin

I have a need to write data to the Windows clipboard from a Python script.
I found a nice, simple solution @
http://wiki.wxpython.org/index.cgi/ClipBoard. The problem is, I can only
get it to work from within the PythonWin and SPE IDE's. I get errors if I
try to run the exact same code from the command line or via IDLE's
interactive shell. I can't figure it out. Any ideas? Possibly something
missing from my PYTHONPATH environment variable?

Any help is appreciated. Thanks,
Tim

From PythonWin (works fine):
from wxPython.wx import *
wxTheClipboard. Open() True wxTheClipboard. Clear()
wxTheClipboard. SetData(wxTextD ataObject("Test 1")) True wxTheClipboard. Close()
## ctrl+v = Test 1

From IDLE (doesn't work): from wxPython.wx import *
wxTheClipboard. Open() True wxTheClipboard. SetData(wxTextD ataObject("Test 2")) False ## ctrl+v = Test 1
wxTheClipboard. Clear()
## ctrl+v = Test 1
wxTheClipboard. Close()

From Python (command-line) (doesn't work, more verbose errors): from wxPython.wx import *
wxTheClipboard. Open() True wxTheClipboard. SetData(wxTextD ataObject("Test 3")) 02:17:48: Error: Failed to put data on the clipboard (error -2147221008:
coIniti
alize has not been called.)
False wxTheClipboard. Clear()

02:17:56: Debug: ..\..\src\msw\c lipbrd.cpp(554) : 'OleSetClipboar d(NULL)'
failed
with error 0x00000002 (the system cannot find the file specified.).


Jul 18 '05 #1
1 2412

"Tim Rice" <ti*****@nosp am-gmail.com> wrote in message news:bp******** ************@ad elphia.com...
I have a need to write data to the Windows clipboard from a Python script.
I found a nice, simple solution @
http://wiki.wxpython.org/index.cgi/ClipBoard. The problem is, I can only
get it to work from within the PythonWin and SPE IDE's. I get errors if I
try to run the exact same code from the command line or via IDLE's
interactive shell. I can't figure it out. Any ideas? Possibly something
missing from my PYTHONPATH environment variable?


Idle is incompatible with wxPython, what I do when I work in Idle is just double click on the file to open it (don't use the run menu unless you have an error to look up). A programming tool I have found useful with wxPython is Leo (A literate programming tool) found at http://personalpages.tds.net/~edream/front.html
Tom
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3714
by: Rami A. Kishek | last post by:
Please help! Very strange installation problem. First, let me say I successfully installed and use Python 2.2.3 and 2.3 from the EXE binaries on a win ME machine. That machine previously had 1.5.2, and now I have access to all 3 versions. When I tried to do the same on an older machine, however, running Win98 SE (and having had Python 1.5.2 previously installed there), the installation doesn't work: Obvious problems: * IDLE...
14
2878
by: Jive | last post by:
I've un-installed Python 2.4, re-installed Python 2.3 and PythonWin for 2.3, but it's still broke. When I start PythonWin, sometimes it looks like it is going to be okay. But as soon as I open a .py file, the interactive window grabs the focus and will not let go. I am stumped. Is there something PythonWin uses that I could try re-installing? WxPython maybe?
2
2186
by: Chris Lott | last post by:
Can someone elaborate for me what the pywin32 project is exactly? Is PythonWin a replacement for idle? More to the point, do I need to worry about this as I am learning about Python, since Idle and the Windows Installer seem to work fine on my XP box? c
4
2527
by: Thomas Pfaff | last post by:
Hello all, I started using the nice Pythonwin IDE together with Python 2.3 (I have come to prefer its editor to IDLE). My problem is, that when I want to run a script in the debugger, I can give the script name and arguments, but I can't tell it in which directory it should run. I googled this group but didn't find anything helpful so far.
1
1965
by: Bo Peng | last post by:
Dear list, I am using rpy, a python module to control statistical package R from python. Running the following commands >>> from rpy import * >>> r.plot(0) will pass command 'plot' to R and run it. I notice that the R-plot will not refresh (a window is created but the figure is not drawn) until the
3
2973
by: archaegeo | last post by:
I am getting started in Python, and I have looked on both the stackless page and python.org and cannot find the answer to what I think is a simple problem. If I start the python command line or idle, i can If I start pythonwin I get the following error ....No Module named Stackless Any help?
7
6584
by: Clive_S | last post by:
Hi I am trying to use Python with ArcGIS. I have installed Python 2.4. I have an icon for IDLE and command line. I do not see Python PythonWin. How do you install or launch pythonwin?? Thanks
4
3610
by: sterling | last post by:
I'm curious as to why the difference between IDLE and pythonWin when using win32com. opening an excel file, i've attempted to grab the chart information out of the file. commands like co = ChartObjects(1) works in pythonWin but doesn't work in IDLE. however, on both co = chartobjects(1) works just fine.
5
3096
by: Frank L. Thiel | last post by:
I have installed PythonWin from the <pywin32-212.win32-py2.6.exe> distribution. When I try to open it, the message "PyWin32 has encountered a problem ..." appears, and a drwatson error report is generated. Python 2.6 itself, from a cmd window or using IDLE, works without problem. I cannot find any reports of similar behavior in FAQs, forums, or general "googling", and am looking for suggestions of remedies.
0
8425
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8743
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8522
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8622
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5647
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2745
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1973
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1736
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.