ITPub博客

首页 > Linux操作系统 > Linux操作系统 > wxPython - How to use the Clipboard

wxPython - How to use the Clipboard

原创 Linux操作系统 作者:jieforest 时间:2012-06-01 12:54:17 0 删除 编辑

[size=10.5pt]Everyone who uses computers regularly knows that they can copy and paste text.

[size=10.5pt]

[size=10.5pt]What they might notknow is that when you copy something, it goes into a location known as the “clipboard”. Most programsprovide access to a clipboard of some sort, whether it be just within the program itself or to the systemclipboard, which allows items to be copied to other applications.

[size=10.5pt]

[size=10.5pt]The wxPython GUI toolkit also providesclipboard access, which you can use to copy text to and from within your program and even to thesystem clipboard. You can also copy images to the clipboard. In this tutorial, we’ll take a lookat how you can do this in your own code.



pic366.jpg



We’ll start out with a really simple example code snippet. The following contains two buttons, one which copies any text that’s added to the text control and which you can then paste elsewhere, such as in the text box, in a search engine or whatever. The other button also copies to clipboard and then closes the application after flushing the data.

This is supposed to make the data available in the system clipboard even after the application is closed. Both work great on Windows, but wxGTK (i.e. the Linux version) doesn’t work in the latter case. See the bug ticket for more information.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/301743/viewspace-731642/,如需转载,请注明出处,否则将追究法律责任。

下一篇: Groovy 2.0发布
请登录后发表评论 登录
全部评论

注册时间:2008-04-23

  • 博文量
    443
  • 访问量
    508592