Beispiel #1
0
class TkClipboard(Clipboard):
    def __init__(self):
        has_tk = False
        self.r = None
        try:
            if sys.version_info[0] < 3:
                from Tkinter import Tk, TclError
            else:
                from tkinter import Tk, TclError
            has_tk = True
        except ImportError:
            print("tinker not found, no Tk copy&paste available")
        if has_tk:
            try:
                self.r = Tk()
                self.r.withdraw()
            except TclError:
                print("tkinter not properly installed, no Tk copy&paste available")
        else:
            self.r = None

    def copy_to(self, text):
        if self.r is not None:
            self.r.clipboard_clear()
            self.r.clipboard_append(text)
            self.r.update()
        else:
            print(text)

    def copy_from(self):
        text = ''
        if self.r is not None:
            self.r.update()
            text = self.r.selection_get(selection="CLIPBOARD")
        return text
def work_with_list():
    str1 = ','.join(found)
    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(str1)
    r.destroy()
Beispiel #3
0
def copy_text(text):
    # http://stackoverflow.com/a/4203897/166700
    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(text)
    r.destroy()
def PutAddressIntoClipboard(address):
    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(address)
    r.destroy()
    return
Beispiel #5
0
Datei: s.py Projekt: hy0712/test
 def printinfo(self):
     self.plainTextEdit.setPlainText(self.tr(''))
     jpg_path = self.lineEdit.text()
     scale = self.spinBox_scale.value()
     line_num = self.spinBox.value()
     if os.path.isdir(jpg_path):
         jpg_path = jpg_path.replace('\\', '/')
         jpg_list = [jpg_path + '/' + j for j in os.listdir(jpg_path) if os.path.isfile(jpg_path + '/' + j)]
         imgext = ['.jpg', '.JPG', '.jpeg', '.JPEG']
         from Tkinter import Tk
         r = Tk()
         r.withdraw()
         r.clipboard_clear()
         # self.plainTextEdit.insertPlainText("<table>")
         for jpg in jpg_list:
             if os.path.splitext(jpg)[-1] in imgext:
                 img = Image.open(jpg)
                 img_width = img.size[0] * scale * 0.01
                 img_height = img.size[1] * scale * 0.01
                 img_name = jpg.replace('/', '\\')
                 if line_num == 0:
                     val = '<table><img src="%s" width="%d" height="%d">\r' % (
                         img_name, img_width, img_height)
                 else:
                     val = '%s<img src="%s" width="%d" height="%d">\r' % (
                         '<table>' * (line_num + 1), img_name, img_width, img_height)
                 self.plainTextEdit.insertPlainText(val)
                 r.clipboard_append(val)
                 # self.plainTextEdit.setPlainText(str(jpg_list)[1:-1])
                 # self.plainTextEdit.setPlainText(self.tr('asdasdasdasdasdasd'))
         r.destroy()
     else:
         QtGui.QMessageBox.warning(self, self.tr("提示"), self.tr("请给一个有效路径"))
Beispiel #6
0
def do_string_encrypt():
    r = Tk()

    if len(sys.argv) == 1:
        plaintext = r.clipboard_get()
        print('Encrypting from clipboard: %s' % plaintext)
    else:
        plaintext = sys.argv[1]

    print('Encrypting: %s' % plaintext)

    hex_text = plaintext.encode('hex')

    print('Raw hex: %s' % hex_text)

    ciphertext = ""

    for c in hex_text:
        if c >= '0' and c <= '9':
            int_value = int(c)
        else:
            int_value = ord(c) - ord('a') + 10

        ciphertext = ciphertext + REPLACE_DICTIONARY[int_value]

    print('Ciphertext: %s' % ciphertext)
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(ciphertext)
    r.destroy()
Beispiel #7
0
def print_to_clipboard(string):
	from Tkinter import Tk
	r = Tk()
	r.withdraw()
	r.clipboard_clear()
	r.clipboard_append(string)
	r.destroy()
Beispiel #8
0
def add_to_clipboard(str):
    from Tkinter import Tk
    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(str)
    r.destroy()
 def copyToClipboard(self, text):
     from Tkinter import Tk
     w = Tk()
     w.withdraw()
     w.clipboard_clear()
     w.clipboard_append(text)
     w.destroy()
Beispiel #10
0
def copyToClipboard(s):
    # (Doesn't work in python 3, so we use python 2)
    root = Tk()
    root.withdraw()
    root.clipboard_clear()
    root.clipboard_append(s)
    root.destroy()
def main():
  aList = []
  check = 'y'
  clipOut = ""

  print ""  
  print "***************************"
  print "*  Calendar List Builder  *"
  print "*  Updated:  09/13/2013   *"
  print "***************************"

#  year = getValidIntYear('CALENDAR YEAR (ie. 2013-2015,13)', 2013 , 2015)
  dat = datetime.datetime.now()
  year = int( dat.strftime('%Y') )
  print "Today: ", dat.strftime('%A, %m/%d/%Y')
 
  while check == 'y':
    print ""
    print "[ Group Header ]"

    dt = getdt(year)
    #print dt
    header = dt + ", Eastern Time"
    #print "Group header:  ", header

    print "[ Time Slots ]"
    openTimes = buildCalTimes()

    aList.append(header)
    
    for each in openTimes:
      aList.append(dt + ', ' + each)

    check = raw_input("Is there another date to add - Yes/No(Default) ?")
    if check == 'y':
      aList.append("")

  print ""
  print "[ Return List ]"  
  print ""
  
  for each in aList:
   print each

  clipOut = '\n'.join(aList)

  print ""

  # Clipboard stuff

  r = Tk() 
  r.withdraw()
  r.clipboard_clear()
  r.clipboard_append(clipOut) 
  
  print "List copied to clipboard.  Press enter to quit."
  check = raw_input("")
  r.destroy()
 
  exit(0)
Beispiel #12
0
 def onCopyButtonClicked(self, numFidLabel):
     if self.numFidLabel >= 1:
         self.outputTransform = '[' + str(
             self.ImageToProbeMan.GetElement(0, 0)
         ) + ',' + str(self.ImageToProbeMan.GetElement(0, 1)) + ',' + str(
             self.ImageToProbeMan.GetElement(0, 2)
         ) + ',' + str(self.ImageToProbeMan.GetElement(0, 3)) + ',' + str(
             self.ImageToProbeMan.GetElement(1, 3)
         ) + ';' + str(self.ImageToProbeMan.GetElement(1, 0)) + ',' + str(
             self.ImageToProbeMan.GetElement(1, 1)
         ) + ',' + str(self.ImageToProbeMan.GetElement(1, 2)) + ',' + str(
             self.ImageToProbeMan.GetElement(1, 3)
         ) + ';' + str(self.ImageToProbeMan.GetElement(2, 0)) + ',' + str(
             self.ImageToProbeMan.GetElement(
                 2, 1)) + ',' + str(self.ImageToProbeMan.GetElement(
                     2, 2)) + ',' + str(
                         self.ImageToProbeMan.GetElement(2, 3)) + ']'
     else:
         self.outputTransform = 'Calibration Required'
     root = Tk()
     root.overrideredirect(1)
     root.withdraw()
     root.clipboard_clear()
     root.clipboard_append(self.outputTransform)
     root.update()
     root.destroy()
Beispiel #13
0
def main():
    parser = argparse.ArgumentParser()

    parser.add_argument("--l",
                        default=24,
                        metavar='password_length',
                        help="password length, default is 24")
    parser.add_argument("--p", action='store_true', help="use punctuation")

    args = parser.parse_args()
    #     print args.l
    #     print args.p

    # Assemble base alphabet and generate password
    myrg = random.SystemRandom()
    alphabet = string.ascii_letters + string.digits
    if args.p:
        alphabet += string.punctuation
    pw = str().join(myrg.choice(alphabet) for _ in range(int(args.l)))

    print pw

    # put password in clipboard
    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(pw)
    r.destroy()
Beispiel #14
0
def set_clipboard(text, datatype=None):
    """
    Arg datatype currently not used. (This can be used to get e.g. an image from clipboard instead of text.)
    For now, this is generally assumed to be unicode text.
    From http://stackoverflow.com/questions/579687/how-do-i-copy-a-string-to-the-clipboard-on-windows-using-python
    """
    if 'xerox' in sys.modules.keys():
        xerox.copy(text)
    elif 'pyperclip' in sys.modules.keys():
        pyperclip.copy(text)
    elif 'gtk' in sys.modules.keys():
        clipboard = gtk.clipboard_get()
        text = clipboard.set_text(text)
    elif 'win32clipboard' in sys.modules.keys():
        wcb = win32clipboard
        wcb.OpenClipboard()
        wcb.EmptyClipboard()
        # wcb.SetClipboardText(text)  # doesn't work
        # SetClipboardData Usage:
        # >>> wcb.SetClipboardData(<type>, <data>)
        # wcb.SetClipboardData(wcb.CF_TEXT, text.encode('utf-8')) # doesn't work
        wcb.SetClipboardData(wcb.CF_UNICODETEXT, unicode(text)) # works
        wcb.CloseClipboard() # User cannot use clipboard until it is closed.
    else:
        # If code is run from within e.g. an ipython qt console, invoking Tk root's mainloop() may hang the console.
        tkroot = Tk()
        # r.withdraw()
        tkroot.clipboard_clear()
        tkroot.clipboard_append(text)
        tkroot.mainloop() # the Tk root's mainloop() must be invoked.
        tkroot.destroy()
Beispiel #15
0
def copyToClipboard(string):
    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(string)
    r.update() # now it stays on the clipboard after the window is closed
    r.destroy()
Beispiel #16
0
def add_to_clipboard(the_text):
	from Tkinter import Tk
	clip=Tk()
	clip.withdraw()
	clip.clipboard_clear()
	clip.clipboard_append(the_text)
	clip.destroy
Beispiel #17
0
def copyToClipboard(cstr):
    from Tkinter import Tk
    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(cstr)
    r.destroy()    
Beispiel #18
0
def set_clipboard(text, datatype=None):
    """
    Arg datatype currently not used. Will generally assumed to be unicode text.
    From http://stackoverflow.com/questions/579687/how-do-i-copy-a-string-to-the-clipboard-on-windows-using-python
    """
    if 'xerox' in sys.modules.keys():
        xerox.copy(text)
    elif 'pyperclip' in sys.modules.keys():
        pyperclip.copy(text)
    elif 'gtk' in sys.modules.keys():
        clipboard = gtk.clipboard_get()
        text = clipboard.set_text(text)
    elif 'win32clipboard' in sys.modules.keys():
        wcb = win32clipboard
        wcb.OpenClipboard()
        wcb.EmptyClipboard()
        # wcb.SetClipboardText(text)  # doesn't work
        # SetClipboardData Usage:
        # >>> wcb.SetClipboardData(<type>, <data>)
        # wcb.SetClipboardData(wcb.CF_TEXT, text.encode('utf-8')) # doesn't work
        wcb.SetClipboardData(wcb.CF_UNICODETEXT, unicode(text)) # works
        wcb.CloseClipboard() # User cannot use clipboard until it is closed.
    else:
        # If code is run from within e.g. an ipython qt console, invoking Tk root's mainloop() may hang the console.
        r = Tk()
        # r.withdraw()
        r.clipboard_clear()
        r.clipboard_append(text)
        r.mainloop() # the Tk root's mainloop() must be invoked.
        r.destroy()
Beispiel #19
0
def add_time(terra_time_01, aqua_time_01):
    # 添加每日的下载时间,一个参数就增加一天,否则增加两天
    from xml.etree import ElementTree
    filepath = r"D:\03-Study\Python\Module\modis\config.xml"
    xmldoc = ElementTree.parse(filepath)
    node = xmldoc.find('TerraTime01')
    node.text = terra_time_01
    node = xmldoc.find('AquaTime01')
    node.text = aqua_time_01
    xmldoc.write(r"D:\03-Study\Python\Module\modis\config.xml")

    terra = "Terra: " + str(int(
        terra_time_01[0:2])) + ":" + terra_time_01[2:4] + " - " + str(
            int(terra_time_01[0:2]) + 8) + ":" + terra_time_01[2:4]
    aqua = "Aqua: " + str(int(
        aqua_time_01[0:2])) + ":" + aqua_time_01[2:4] + " - " + str(
            int(aqua_time_01[0:2]) + 8) + ":" + aqua_time_01[2:4]
    print(terra + "\n" + aqua)

    from Tkinter import Tk
    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(terra + "\n\n" + aqua)
    r.update()
    r.destroy()
Beispiel #20
0
def main():
    parser = argparse.ArgumentParser()
    
    parser.add_argument("--l",     default=24,                 metavar='password_length',        help="password length, default is 24")
    parser.add_argument("--p",     action='store_true',                                          help="use punctuation")
    
    args = parser.parse_args()
#     print args.l
#     print args.p

    # Assemble base alphabet and generate password
    myrg = random.SystemRandom()
    alphabet = string.ascii_letters + string.digits
    if args.p:
        alphabet += string.punctuation
    pw = str().join(myrg.choice(alphabet) for _ in range(int(args.l)))
    
    print pw

    # put password in clipboard    
    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(pw)
    r.destroy()
Beispiel #21
0
 def copy2clip(self, caption):
     r = Tk()
     r.withdraw()
     r.clipboard_clear()
     r.clipboard_append(caption)
     r.update()  # now it stays on the clipboard after the window is closed
     r.destroy()
Beispiel #22
0
 def addtoclipboard(self,text):
     r = Tk()
     r.withdraw()
     r.clipboard_clear()
     r.clipboard_append(text)
     r.update() # ensures it stays in the clipboard when window closes
     r.destroy()
def main():
    aList = []
    check = 'y'
    clipOut = ""

    print ""
    print "***************************"
    print "*  Calendar List Builder  *"
    print "*  Updated:  09/13/2013   *"
    print "***************************"

    #  year = getValidIntYear('CALENDAR YEAR (ie. 2013-2015,13)', 2013 , 2015)
    dat = datetime.datetime.now()
    year = int(dat.strftime('%Y'))
    print "Today: ", dat.strftime('%A, %m/%d/%Y')

    while check == 'y':
        print ""
        print "[ Group Header ]"

        dt = getdt(year)
        #print dt
        header = dt + ", Eastern Time"
        #print "Group header:  ", header

        print "[ Time Slots ]"
        openTimes = buildCalTimes()

        aList.append(header)

        for each in openTimes:
            aList.append(dt + ', ' + each)

        check = raw_input("Is there another date to add - Yes/No(Default) ?")
        if check == 'y':
            aList.append("")

    print ""
    print "[ Return List ]"
    print ""

    for each in aList:
        print each

    clipOut = '\n'.join(aList)

    print ""

    # Clipboard stuff

    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(clipOut)

    print "List copied to clipboard.  Press enter to quit."
    check = raw_input("")
    r.destroy()

    exit(0)
Beispiel #24
0
def copy_text(text):
    # http://stackoverflow.com/a/4203897/166700
    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(text)
    r.destroy()
Beispiel #25
0
def to_clipboard(text):
    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(text)
    r.update()  # now it stays on the clipboard after the window is closed
    r.destroy()
Beispiel #26
0
def BDF(bus, device, function):
    value = "0x%08X" % (pciexbar | bus << 20 | device << 15 | function << 12)
    print value
    c = Tk()
    c.withdraw()
    c.clipboard_clear()
    c.clipboard_append(value)
    c.destroy()
Beispiel #27
0
 def copy_code(event):
     # Copies the source code to clipboard
     from Tkinter import Tk
     r = Tk()
     r.withdraw()
     r.clipboard_clear()
     r.clipboard_append(copy_text)
     r.destroy()
Beispiel #28
0
def addToClipboard(string):
    from Tkinter import Tk
    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(string)
    r.update()
    r.destroy()
Beispiel #29
0
 def addToClipboard(self, string):
     """字符串添加到剪贴板"""
     r = Tk()
     r.withdraw()
     r.clipboard_clear()
     r.clipboard_append(string)
     r.update()
     r.destroy()
def setClipboardText(s):
    from Tkinter import Tk
    text = str(s)
    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(text)
    r.destroy()
Beispiel #31
0
def clip(self):
    locale.setlocale(locale.LC_ALL, '')
    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(locale.format("%.1f", distance / mpc2kpc, grouping=False) + '\t' + locale.format("%.0f", vinf, grouping=False) + '\t' + locale.format("%.2f", rc, grouping=False) + '\t' + locale.format("%.2f", p0, grouping=False) + '\t' + locale.format("%.2E", M, grouping=False))
    r.update() # now it stays on the clipboard after the window is closed
    r.destroy()
Beispiel #32
0
def copy(string, **kwargs):
    """Copy given string into system clipboard."""
    window = Tk()
    window.withdraw()
    window.clipboard_clear()
    window.clipboard_append(string)
    window.destroy()
    return
Beispiel #33
0
def BDF(bus, device, function):
    value = "0x%08X" % (pciexbar | bus << 20 | device << 15 | function << 12)
    print value
    c = Tk()
    c.withdraw()
    c.clipboard_clear()
    c.clipboard_append(value)
    c.destroy()
Beispiel #34
0
    def copy_text(self):

        r = Tk()
        r.withdraw()
        r.clipboard_clear()
        r.clipboard_append(self.get_selected_text())
        r.update()
        r.destroy()
Beispiel #35
0
def copy(string, **kwargs):
    """Copy given string into system clipboard."""
    window = Tk()
    window.withdraw()
    window.clipboard_clear()
    window.clipboard_append(string)
    window.destroy()
    return
    def copyToClipboard(self):
	r = Tk()
	r.withdraw()
	r.clipboard_clear()
	r.clipboard_append("Enviromental Benefit\t%\nFlow-Frequency Index\t" + str(self.module.FF) + 
	"\nVolume Reduction Index\t" + str(self.module.VR) + 
	"\nFiltered Flow Volume Index\t" +str(self.module.FV) + 
	"\nWater Quality Index\t" + str(self.module.WQ) + "\n")
Beispiel #37
0
 def copy_code(event):
     # Copies the source code to clipboard
     from Tkinter import Tk
     r = Tk()
     r.withdraw()
     r.clipboard_clear()
     r.clipboard_append(copy_text)
     r.destroy()
Beispiel #38
0
def clip_board(input="here is clipboard"):
    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(input)
    result = r.selection_get(selection="CLIPBOARD")
    #r.destroy() #this line cause ERROR! deactivate it
    print "now in clipboard:\n", result
Beispiel #39
0
def copy_array_to_clipboard(arr):
    to_str=''
    for a in arr:
        to_str=to_str+str(a)+'\t'
    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(to_str)
    r.destroy()
Beispiel #40
0
def copy_array_to_clipboard(arr):
    to_str = ''
    for a in arr:
        to_str = to_str + str(a) + '\t'
    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(to_str)
    r.destroy()
Beispiel #41
0
def setClipboardTextTk(s):
    from Tkinter import Tk
    text = unicode(s)
    try:
        r = Tk()
        r.withdraw()
        r.clipboard_clear()
        r.clipboard_append(text)
    finally:
        r.destroy()
Beispiel #42
0
def copy2clipboard(text):
    """Copies text to clipboard"""

    interface = Tk()
    interface.withdraw()  # don't popup screen window
    interface.clipboard_clear()
    interface.clipboard_append(text)
    interface.update(
    )  # now it stays on the clipboard after the window is closed
    interface.destroy()
 def copyToClipboard(self):
     r = Tk()
     r.withdraw()
     r.clipboard_clear()
     r.clipboard_append("Enviromental Benefit\t%\nFlow-Frequency Index\t" +
                        str(self.module.FF) + "\nVolume Reduction Index\t" +
                        str(self.module.VR) +
                        "\nFiltered Flow Volume Index\t" +
                        str(self.module.FV) + "\nWater Quality Index\t" +
                        str(self.module.WQ) + "\n")
Beispiel #44
0
def main():
	# create a searchReplace instance from filename
	i18nSR = SearchReplace.SearchReplace(I18N_FN)
	# clipboard object
	r = Tk()
	print("TOPIC: "+TOPIC)
	while(True):
		s = str(raw_input('String to i18n >> '))
		
		
		#end prog
		if len(s)==0:
			r.destroy()
			sys.exit()

		# change topic
		if("chTopic" in s):
			global I18N_PREFIX,PATH,IS_MULTI
			topic = s.split()[1]
			print("new Topic: ",topic)
			nuPrefix = PATH+topic+"."
			#replace online.google.apps.welcome with online.google.apps.NEWTOPIC
			i18nSR.replace(I18N_PREFIX,nuPrefix+"\n\n",IS_MULTI)
			#write changes to file
			i18nSR.write()
			I18N_PREFIX = nuPrefix
			continue
		# update file
		if("upFile" in s):
			print("updated file")
			i18nSR.write()
			#update instance of i18nSR
			i18nSR = SearchReplace.SearchReplace(I18N_FN)
			continue

		key = keyString(s)
		custom = str(raw_input('Use suggested key - [ENTER]  enter your own key:\n'))
		
		if len(custom)>0:
			# use custom
			key = I18N_PREFIX+'.'+custom
		elif custom=='\'':
			key = I18N_PREFIX

		#find online.google.apps.welcome and insert 1 line afterwards with key=s
		i18nSR.findInsert(I18N_PREFIX, key+"="+s+"\n", 1, IS_MULTI)
		i18nSR.write()

		scalaMessage = '@Messages("'+key+'")'
		print(scalaMessage)		
		
		#push scala message to clipboard
		r.withdraw()
		r.clipboard_clear()
		r.clipboard_append(scalaMessage)
Beispiel #45
0
    def _copyBtnOnClicked(self):
        text = str(self._displayTextEdit.toPlainText())

        if not text:
            return

        r = Tk()
        r.withdraw()
        r.clipboard_clear()
        r.clipboard_append('%s' % text)
        r.destroy()
Beispiel #46
0
 def key_press_event(self, widget, event):
 
     keyname = gtk.gdk.keyval_name(event.keyval).lower()
     if keyname == "c" and event.state & gtk.gdk.CONTROL_MASK:
         print "copy status to clipboard!"
         from Tkinter import Tk
         r = Tk()
         r.withdraw()
         r.clipboard_clear()
         r.clipboard_append(self._status)
         r.destroy()
Beispiel #47
0
 def copy_command_to_clipboard(command):
     try:
         from Tkinter import Tk
         r = Tk()
         r.withdraw()
         r.clipboard_clear()
         r.clipboard_append(command)
         r.update()
         r.destroy()
     except ImportError:
         pass
    def copyToClipboard(self):
	r = Tk()
	r.withdraw()
	r.clipboard_clear()
	r.clipboard_append("Stream Hydrology and Water quality\t%\nFrequency of Runoff Days (days/year)\t" + str(self.module.FF) + 
	"\nProportion of Total Volume Reduction (%)\t" + str(self.module.VR) + 
	"\nProportion of Filtered Flow Volume \t" +str(self.module.FV) + 
	"\nWater Quality Index\t" + str(self.module.WQ) +
	"\nTSS mean concentration (mg/L)\t" + str(self.module.tableTSS) + 
	"\nTP mean concentration (mg/L)\t" + str(self.module.tableTP) + 
	"\nTN mean concentration (mg/L)\t" + str(self.module.tableTN)+"\n")
Beispiel #49
0
 def copy_command_to_clipboard(command):
     try:
         from Tkinter import Tk
         r = Tk()
         r.withdraw()
         r.clipboard_clear()
         r.clipboard_append(command)
         r.update()
         r.destroy()
     except ImportError:
         pass
Beispiel #50
0
def addToClipboard(string):
    # 从 ArcGIS 导入的注意空格与 tab 键
    # 已经出错两次了
    "将字符串复制到剪贴板上"
    from Tkinter import Tk
    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(string)
    r.update()
    r.destroy()
Beispiel #51
0
def set_clipboard(text):
    """
    Set the Clipboard to the specified string

    """
    from Tkinter import Tk
    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(text)
    r.destroy()
Beispiel #52
0
    def set(self, text):
        """
        Set the contents of the user's clipboard to a string

        text - The text to be copied to the clipboard
        """

        t = Tk()
        t.withdraw()
        t.clipboard_clear()
        t.clipboard_append(text)
        t.destroy()
    def copy_to_clipboard(self, text):
        from Tkinter import Tk
        r = Tk()
        r.withdraw()
        r.clipboard_clear()
        r.clipboard_append(text.strip())
        r.destroy()

        r = Tk()
        result = r.selection_get(selection = "CLIPBOARD")
        #logger.debug('tried to copy %s to clipboard, got %s' % (text, result))
        r.destroy()
Beispiel #54
0
def copy_to_clipboard(text):
    """Copy text to the clipboard."""
    if platform.system() == 'Darwin':
        subprocess.Popen(["pbcopy", "w"], stdin=subprocess.PIPE).communicate(text.encode('utf8'))
    elif platform.system() == 'Linux':
        subprocess.Popen(["xclip", "-selection", "clipboard"], stdin=subprocess.PIPE).communicate(text.encode('utf8'))
    else:
        r = Tk()
        r.withdraw()
        r.clipboard_clear()
        r.clipboard_append(text)
        r.quit()
Beispiel #55
0
def copyHashToClipboard():
    h = hashlib.sha256()
    hash_str = raw_input('String to be hashed: ')

    c = Tk()
    c.withdraw()
    c.clipboard_clear()

    h.update(hash_str)
    h.digest()

    c.clipboard_append(h.hexdigest())

    print "Copied hash (( " + repr(h.hexdigest()) + " )) to clipboard."
Beispiel #56
0
class Clipboard(object):
    """Container for clipboard access"""
    def __init__(self):
        """store Tk object and hide GUI"""
        self.Tk = Tk()
        self.Tk.withdraw()

    def copy_from(self):
        """Copy contents from clipboard"""
        return self.Tk.clipboard_get()

    def paste_to(self,paste_string):
        """Replace clipboard contents with paste_string"""
        self.Tk.clipboard_clear()
        self.Tk.clipboard_append(paste_string)
Beispiel #57
0
 def copy2clipboard(w, treeview, liststore):
     import platform
     path, col =  treeview.get_cursor()
     if path:
         address =  liststore.get_value( liststore.get_iter(path), 0)
         if platform.system() == 'Windows':
             from Tkinter import Tk
             r = Tk()
             r.withdraw()
             r.clipboard_clear()
             r.clipboard_append( address )
             r.destroy()
         else:
             c = gtk.clipboard_get()
             c.set_text( address )
Beispiel #58
0
 def copy2clipboard(w, treeview, liststore):
     import platform
     path, col =  treeview.get_cursor()
     if path:
         address =  liststore.get_value( liststore.get_iter(path), 0)
         if platform.system() == 'Windows':
             from Tkinter import Tk
             r = Tk()
             r.withdraw()
             r.clipboard_clear()
             r.clipboard_append( address )
             r.destroy()
         else:
             atom = Gdk.atom_intern('CLIPBOARD', True)
             c = Gtk.Clipboard.get(atom)
             c.set_text( address, len(address) )
Beispiel #59
-1
def copy_helper(text):
    '''I have no idea what I'm doing here, but it seems to work ¯\_(ツ)_/¯'''
    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(text)
    r.destroy()