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


Python Tk.clipboard_clear方法代码示例

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


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

示例1: copy_text

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_clear [as 别名]
def copy_text(text):
    # http://stackoverflow.com/a/4203897/166700
    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(text)
    r.destroy()
开发者ID:imclab,项目名称:Eelbrain,代码行数:9,代码来源:tk_ui.py

示例2: copy_helper

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_clear [as 别名]
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()
开发者ID:willxyu,项目名称:pymudclient,代码行数:9,代码来源:gtkgui.py

示例3: copyToClipboard

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

示例4: print_to_clipboard

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_clear [as 别名]
def print_to_clipboard(string):
	from Tkinter import Tk
	r = Tk()
	r.withdraw()
	r.clipboard_clear()
	r.clipboard_append(string)
	r.destroy()
开发者ID:Gambrinus,项目名称:Euler,代码行数:9,代码来源:p1.py

示例5: copyToClipboard

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_clear [as 别名]
def copyToClipboard(cstr):
    from Tkinter import Tk
    r = Tk()
    r.withdraw()
    r.clipboard_clear()
    r.clipboard_append(cstr)
    r.destroy()    
开发者ID:kekschaot,项目名称:timer,代码行数:9,代码来源:timer.py

示例6: set_clipboard

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_clear [as 别名]
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()
开发者ID:thomsen3,项目名称:gelutils,代码行数:32,代码来源:clipboard.py

示例7: copyToClipboard

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_clear [as 别名]
 def copyToClipboard(self, text):
     from Tkinter import Tk
     w = Tk()
     w.withdraw()
     w.clipboard_clear()
     w.clipboard_append(text)
     w.destroy()
开发者ID:GCTMODS,项目名称:joan-s-x-plane-python-scripts,代码行数:9,代码来源:PI_FastPlan.py

示例8: main

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_clear [as 别名]
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)
开发者ID:whuey79,项目名称:calendar-answer-list-creator,代码行数:62,代码来源:dates3.py

示例9: main

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_clear [as 别名]
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()
开发者ID:VestedSkeptic,项目名称:password_gen,代码行数:27,代码来源:pgen.py

示例10: PutAddressIntoClipboard

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

示例11: setClipboardText

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

示例12: copy_code

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_clear [as 别名]
 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()
开发者ID:Tosh007,项目名称:LUI,代码行数:10,代码来源:DemoFramework.py

示例13: copy

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_clear [as 别名]
def copy(string, **kwargs):
    """Copy given string into system clipboard."""
    window = Tk()
    window.withdraw()
    window.clipboard_clear()
    window.clipboard_append(string)
    window.destroy()
    return
开发者ID:Burrito-Bazooka,项目名称:xerox,代码行数:10,代码来源:tkinter.py

示例14: BDF

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_clear [as 别名]
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()
开发者ID:blujan,项目名称:tools,代码行数:10,代码来源:bdf.py

示例15: copyToClipboard

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import clipboard_clear [as 别名]
    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")
开发者ID:cbdot1,项目名称:P8Modules,代码行数:10,代码来源:ReadTableSecondary_Gui.py


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