| | |
Using the wxClipboard
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Nov 2008
Posts: 41
Reputation:
Solved Threads: 1
Okay, Iv spent hours hunting for something to help me and so far nothing has come even close! All the code seems to be either for Windows only, or it simply does not work under Ubuntu 7.10, which is what I'm using.
So, frustrated, Iv opted for a workaround:
I'm using wxGlade to design the interface of the program, so I simply dropped a text control onto the frame and made it invisible. This is called txtCopyBuffer, and I'm sure you can now see where I'm, going with this!
My apologies to any purists out there, I know it doesn't look pretty, but it does the job, at least until someone, somewhere can tell me how to use the wxClipboard under Linux!
Regards
Max
So, frustrated, Iv opted for a workaround:
I'm using wxGlade to design the interface of the program, so I simply dropped a text control onto the frame and made it invisible. This is called txtCopyBuffer, and I'm sure you can now see where I'm, going with this!
python Syntax (Toggle Plain Text)
#first get the text x = [The text I want to Copy] #place this text into the hidden control self.txtCopyBuffer.SetValue(x) #select all self.txtCopyBuffer.SetSelection(-1,-1) #copy to the clipboard self.txtCopyBuffer.Copy() #clear it for next time self.txtCopyBuffer.Clear()
My apologies to any purists out there, I know it doesn't look pretty, but it does the job, at least until someone, somewhere can tell me how to use the wxClipboard under Linux!
Regards
Max
Since I don't have any of the many versions of Linux, I can not test wx.Clipboard. I think it would be easier to store your text in a file for use across programs.
If you use a wx.TextCtrl, can you highlight, rightclick and copy/cut and paste from the popup menu? That would use the clipboard.
If you use a wx.TextCtrl, can you highlight, rightclick and copy/cut and paste from the popup menu? That would use the clipboard.
No one died when Clinton lied.
•
•
Join Date: Nov 2008
Posts: 41
Reputation:
Solved Threads: 1
Thanks sneekula, the problem that I have is that the selected text in a wx.HTML control, and while its possible to select the text, creating a popup menu is very hard because there is no way to get the mouse location from the HTML control, and of course, it doesn't pick up keyboard events for itself either.
That means that any solution will require custom event handlers to try and get keyboard input (CTRL + C) from the HTML control, and if a popup menu is used, also some method of getting the mouse position from it as well.
Iv kind of cheated by getting the selected text and using a button to copy it (and a text control while I'm doing it). I know its a workaround, but it works and it seems less complex than following any other methods.
Max
That means that any solution will require custom event handlers to try and get keyboard input (CTRL + C) from the HTML control, and if a popup menu is used, also some method of getting the mouse position from it as well.
Iv kind of cheated by getting the selected text and using a button to copy it (and a text control while I'm doing it). I know its a workaround, but it works and it seems less complex than following any other methods.
Max
![]() |
Other Threads in the Python Forum
- Previous Thread: sequence problem
- Next Thread: python config files zip
| Thread Tools | Search this Thread |
accessdenied advanced apache application argv beginner change command csv def dictionary dynamic edit enter event examples file float format function google gui homework import inches input jaunty java keyboard lapse library line lines linux list lists loop microphone mouse movingimageswithpygame mysql newb number numbers numeric obexftp output parameters parsing path phonebook port prime programming projects py2exe pygame pygtk pyopengl python random recursion redirect remote return reverse scrolledtext session simple skinning smtp software sprite statictext stderr string strings syntax table tennis terminal text thread threading time tkinter tlapse trick tuple tutorial ubuntu unicode unit urllib urllib2 variable voip windows wordgame wxpython






