Forum: Poser Python Scripting


Subject: Useful Code Snippets

structure opened this issue on Jun 27, 2019 ยท 94 posts


structure posted Fri, 10 April 2020 at 7:04 PM Forum Coordinator

Copy to Clipboard

import wx
def copytoclipboard( item  = None ):
    clipboard = wx.TheClipboard
    if not clipboard.IsOpened():
        clipboard.Open()
        data = wx.TextDataObject()
        data.SetText( item )
        clipboard.SetData(data)
    clipboard.Close()

without wx :

from subprocess import check_call
class clipboard:
    def copy2clip(self, txt):
        cmd='echo '+txt.strip()+'|clip'
        return check_call(cmd, shell=True)

Locked Out