当前位置: 首页>>代码示例>>Python>>正文


Python Tk.clipboard_get方法代码示例

本文整理汇总了Python中Tkinter.Tk.clipboard_get方法的典型用法代码示例。如果您正苦于以下问题:Python Tk.clipboard_get方法的具体用法?Python Tk.clipboard_get怎么用?Python Tk.clipboard_get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tkinter.Tk的用法示例。


在下文中一共展示了Tk.clipboard_get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getClipboardText

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_get [as 别名]
def getClipboardText():
    from Tkinter import Tk
    r = Tk()
    r.withdraw()
    s = r.clipboard_get()
    r.destroy()
    return s
开发者ID:kleopatra999,项目名称:downpoured_scite_editor,代码行数:9,代码来源:filesystem.py

示例2: getURLFromClipboard

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_get [as 别名]
def getURLFromClipboard():
    from Tkinter import Tk
    r = Tk()
    r.withdraw()
    url = r.clipboard_get()
    r.destroy
    print "Copied URL from clipboard"
    return url
开发者ID:CodeGradox,项目名称:4chan-image-downloader,代码行数:10,代码来源:4chan.py

示例3: from_clipboard

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_get [as 别名]
def from_clipboard():
    root = Tk()
    s = root.clipboard_get()
    print s
    if s[0] == '{':
        out = to_tex(s)
    else:
        out = to_mat(s)
    print out
    copy(out, root)
    root.destroy() 
开发者ID:richardmillson,项目名称:matrix_detex,代码行数:13,代码来源:matrix_detex.py

示例4: getClipboardTextTk

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_get [as 别名]
def getClipboardTextTk():
    from Tkinter import Tk
    try:
        r = Tk()
        r.withdraw()
        s = r.clipboard_get()
    except BaseException as e:
        if 'selection doesn\'t exist' in str(e):
            s = ''
        else:
            raise
    finally:
        r.destroy()
    return s
开发者ID:downpoured,项目名称:pyxels,代码行数:16,代码来源:common_util.py

示例5: Clipboard

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_get [as 别名]
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)
开发者ID:jcopetre,项目名称:lib,代码行数:17,代码来源:winUtils.py

示例6: printevent

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_get [as 别名]
 def printevent(self, event):
     
     if "BackSpace" in str(event):
         self.__input_stack = self.__input_stack[:-1]
         return
         
     cmd = None
     
     if "mouse" in str(event):
         process_name, _, _ = str(event).split("|")
         key = ''
         ascii = ''
         return
     
     process_name, key, ascii, _ = str(event).split("|")
     self.__input_stack.append((process_name, key, ascii))
     
     if len(self.__input_stack) >= 3:
         cntrl = self.__input_stack[0][1].lower()
         shift = self.__input_stack[1][1].lower()
         cntrl_v = self.__input_stack[2][1].lower()
         if "control" in cntrl and (("v" in shift) or ("shift" in shift and "v" in cntrl_v)):
             self.__typed = False
             
             if "return" in key.lower():
                 r = Tk()
                 r.withdraw()
                 cp_data = r.clipboard_get()
                 r.destroy()
                 cmd = (cp_data, self.__input_stack[:-1][0][0])
     
     if "return" in key.lower() and not cmd:
         cmd = ("".join([x[1] for x in self.__input_stack[:-1]]), self.__input_stack[:-1][0][0])
                 
     with open("logs.txt", "a") as myfile: 
         if cmd:
             cmd_time = str(datetime.datetime.now())
             machine_name = str(socket.gethostname())
                  
             command = '<xy>%d %s %s %s "%s" enter "%s" on %s' % (self.__cmd_count, cmd_time, 
                                                          machine_name, "typed" if self.__typed else "cp-pased",cmd[0], cmd[1], "keyboard")
             myfile.write(command + "\n")
             self.__cmd_count += 1
             self.__input_stack = list()
开发者ID:oskgeek,项目名称:pyhooks,代码行数:46,代码来源:pyhook.py

示例7: main

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_get [as 别名]
def main():
#  if len(sys.argv) != 2: # generating some usage info, if there's not enought parameters
#    print "Sybase query plan parser"
#    print "Script process file with query plan (generated by 'set showplan on' query)\n"
#    print "Usage: python " + sys.argv[0] + " %in_file_name% \n\t%in_file_name%\tfull file name with query plan to parse"
#    sys.exit(1)

  if (len(sys.argv) == 2):
    in_file  = sys.argv[1]
    if os.path.isfile(in_file) == False: # chech if input file exists
      print "ERROR: file [" + in_file + "] doesn't exists"
      sys.exit(1)
    parser = PlanParser(filename = in_file)
  else:
    r = Tk()
    r.withdraw()
    content = r.clipboard_get()
    parser = PlanParser(content = content)


  parser.parse()
  parser.print_res()
开发者ID:cpasik,项目名称:py-tools,代码行数:24,代码来源:query_plan_parse.py

示例8: Clipboard

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_get [as 别名]
class Clipboard(object):
    def __init__(self):
        self._widget = Tk()
        self._widget.withdraw()

    def get(self):
        try:
            return self._widget.clipboard_get()
        except TclError:
            return None

    def post(self, text):
        self._widget.clipboard_clear()
        self._widget.clipboard_append(text)

    def destroy(self):
        self._widget.destroy()

    def __enter__(self):
        return self

    def __exit__(self, type, value, traceback):
        self.destroy()
开发者ID:mshuffett,项目名称:Clipboard,代码行数:25,代码来源:clipboard.py

示例9: approximateAndSimplify

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_get [as 别名]
	z = 'Gradient-Fractal1,Background {\n'
	z += 'gradient:\n'
	z += '  title="Extracted" smooth=yes rotation=1\n  '
	
	# Insert gradient here.
	
	chaoticaAppend = 1.0/256.0
	
	hsvdata = approximateAndSimplify(values)
	
	for pos, r, g, b in hsvdata:	
		position = int((400.0*pos)/256.0)
		color = RGBFloatToInt(r, g, b)
		indexStr = 'index='+str(position)
		colorStr = 'color='+str(color)
		z += ' ' + indexStr + ' ' + colorStr
		
	z += '\n'
	z += 'opacity:\n'
	z += 'smooth=yes index=0 opacity=255\n'
	z += '}\n'
	
	return z

if __name__ == '__main__':	
	r = Tk()
	r.withdraw()
	clipboard = r.clipboard_get()
	gradient = extract_gradient(clipboard)	
	r.clipboard_append(gradient)
		
开发者ID:chaosfissure,项目名称:ChaoticaTools,代码行数:32,代码来源:reverseEngineerGrad.py

示例10: Tk

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_get [as 别名]
from Tkinter import Tk
import re 

r = Tk()
r.withdraw()
txt = r.clipboard_get()
txt = re.sub(' style=".*?"', "", txt)
txt = re.sub(' class=.*?>', ">", txt)
txt = re.sub(' type=.*?>', ">", txt)
txt = re.sub('<FONT.*?>', "", txt)
txt = re.sub('</FONT>', "", txt)
txt = re.sub('<DIV.*?>', "", txt)
txt = re.sub('</DIV>', "", txt)
txt = re.sub('<TR.*?>', "<TR>", txt)
txt = re.sub('<TD.*?>', "<TD>", txt)
txt = re.sub('<P.*?>', "<P>", txt)
txt = re.sub('<SPAN.*?>', "", txt)
txt = re.sub('</SPAN>', "", txt)
txt = re.sub('&nbsp;', " ", txt)
txt = re.sub(' +', " ", txt)
txt = txt.replace('<P> </P>','')
txt = txt.replace('<BR>','<BR>\n')
txt = txt.strip(' \t\n')
r.clipboard_clear()
r.clipboard_append(txt)
r.destroy()


开发者ID:sczeck,项目名称:clipboard-formatting-note-aid,代码行数:28,代码来源:clipboard_remove_html_style.py

示例11: Tk

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_get [as 别名]
import pafy
from Tkinter import Tk
r = Tk()
r.withdraw()
flag=0
result=r.clipboard_get()
type=raw_input("Hit 1 for video,2 for playlist")
type=int(type)
qual=raw_input("Hit 1 for best clarity, 2 for worst, 3 for other")
qual=int(qual)
if qual==3:
	flag=1
c=0
if type==1:
	url = result
	video = pafy.new(url)
	best = video.streams
	for b in best:
		print str(c)+str(b)
		c+=1;
	if flag==1:
		index=raw_input("Enter index")
		index=int(index)
	elif qual==2:
		index=c-1
	elif qual==1:
		index=0
		
	filename = video.streams[index]
	print filename
	x=filename.download(filepath=filename.title + "." + filename.extension)
开发者ID:nagendragpu,项目名称:Youtube-Downloader,代码行数:33,代码来源:down.py

示例12: _tk

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_get [as 别名]
 def _tk(self):
     tk = TK()
     yield tk.clipboard_get()
     tk.destroy()
开发者ID:Eficode,项目名称:robotframework-imagehorizonlibrary,代码行数:6,代码来源:__init__.py

示例13: reload

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_get [as 别名]
import os
import subprocess
import codecs
import time
import threading

# get encoding
reload(sys)
sys.setdefaultencoding("utf-8")
enc = sys.getdefaultencoding()
print "default encoding : " + str(enc)

# get clipboard & parse encode
root = Tk()
root.withdraw()
src = root.clipboard_get()
if type(src).__name__ != "unicode":
    src = src.decode(enc)
print "______________________________________________"
print src
print "______________________________________________"

# run command in shell
def run_cmd(bashCmd):
    print "run command : " + str(bashCmd)
    process = subprocess.Popen(bashCmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    res = ""
    while True:
        output = process.stdout.readline()
        if output == "" and process.poll() is not None:
            break
开发者ID:becxer,项目名称:instantcode,代码行数:33,代码来源:instantcode.py

示例14: get_clipboard

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_get [as 别名]
def get_clipboard():
    from Tkinter import Tk
    root = Tk()
    root.withdraw()
    clipboard = root.clipboard_get()
    return clipboard
开发者ID:anver,项目名称:Youtube-Watch-History-Scraper,代码行数:8,代码来源:cookie_import.py

示例15: PreparePasteCode

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_get [as 别名]
def PreparePasteCode():
    r = Tk()
    r.withdraw()
    code = r.clipboard_get()
    r.destroy()
    return code
开发者ID:Kirem,项目名称:PastebinUpload,代码行数:8,代码来源:pastebin_upload.py


注:本文中的Tkinter.Tk.clipboard_get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。