當前位置: 首頁>>代碼示例>>Python>>正文


Python clipboard.set方法代碼示例

本文整理匯總了Python中clipboard.set方法的典型用法代碼示例。如果您正苦於以下問題:Python clipboard.set方法的具體用法?Python clipboard.set怎麽用?Python clipboard.set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在clipboard的用法示例。


在下文中一共展示了clipboard.set方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: bloodforum

# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import set [as 別名]
def bloodforum():
	# BloodForum is used on Hacker's Forum Page To Make Blood Text
	try:
		colors = ["#e00000","#c70000","#af0000","#a10000","#8e0000","#7d0000","#a00000","#ad0000","#ca0000","#e00000"]
		new = ""
		s = 0
		a = 0
		n = 2
		while 1:
			msg = unicode(raw_input("Message: "))
			if msg == "!quit":
				if verbose: print "Stopped"
				break
			msg = [msg[i:i+n] for i in range(0, len(msg), n)]
			for _ in msg:
				if s == 10:
					s = a
					a = 1
					if a == 10:
						a = 0
				if _ == " ":
					new = new + _
					s = s - 1
				else:
					new = new + "[color=" + colors[s] + "]" + _ + "[/color]"
				s = s + 1
			clipboard.set(new)
			new = ""
	except Exception as e:
		if verbose: print traceback.print_exc(file=sys.stdout)
		pass 
開發者ID:RussianOtter,項目名稱:networking,代碼行數:33,代碼來源:ColorTerminal.py

示例2: updown

# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import set [as 別名]
def updown():
	# UpDown Makes Your Text Go Up And Down
	colors = ["#sup","#/sup","#sub","#/sub"]
	s = 0
	new = ""
	msgb = ""
	try:
		while 1:
			sys.stderr = msg = unicode(raw_input("Message: "))
			if msg == "!quit":
				if verbose: print "Stopped"
				break
			if len(msg) >= 100:
				msgb = msg[100:]
				msg = msg[:100]
			msg = msg.split(" ")
			for _ in msg:
				if s == len(colors):
					s = 0
				if _ == " ":
					new = new + " "
					s = s - 1
				else:
					new = new + colors[s].replace("#","[") + "]" + _ + " "
				s = s + 1
			clipboard.set("[c][b][efffff]" + new + msgb)
			if verbose: print "Copied"
			new = ""
			msgb = ""
	except Exception as e:
		if verbose: print traceback.print_exc(file=sys.stdout)
		pass 
開發者ID:RussianOtter,項目名稱:networking,代碼行數:34,代碼來源:ColorTerminal.py

示例3: captcha

# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import set [as 別名]
def captcha():
	# Makes text almost impossible to read
	colors = ["#i","#/i","#i","#/i"]
	s = 0
	new = ""
	msgb = ""
	try:
		while 1:
			sys.stderr = msg = unicode(raw_input("Message: ").replace("a","4").replace("e","3").replace("t","7").replace("i","1").replace("o","0").replace("B","8").replace("s","5"))
			if msg == "!quit":
				if verbose: print "Stopped"
				break
			if len(msg) >= 100:
				msgb = msg[100:]
				msg = msg[:100]
			msg = list(msg)
			for _ in msg:
				if s == len(colors):
					s = 0
				if _ == " ":
					new = new + " "
					s = s - 1
				else:
					new = new + colors[s].replace("#","[") + "]" + _
				s = s + 1
			clipboard.set("[c][b][efffff]" + new + msgb)
			if verbose: print "Copied"
			new = ""
			msgb = ""
	except Exception as e:
		if verbose: print traceback.print_exc(file=sys.stdout)
		pass 
開發者ID:RussianOtter,項目名稱:networking,代碼行數:34,代碼來源:ColorTerminal.py

示例4: italics

# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import set [as 別名]
def italics():
	# italics or not italics, which one?
	colors = ["#i","#/i","#i","#/i"]
	s = 0
	new = ""
	msgb = ""
	try:
		while 1:
			sys.stderr = msg = unicode(raw_input("Message: "))
			if msg == "!quit":
				if verbose: print "Stopped"
				break
			if len(msg) >= 100:
				msgb = msg[100:]
				msg = msg[:100]
			msg = list(msg)
			for _ in msg:
				if s == len(colors):
					s = 0
				if _ == " ":
					new = new + " "
					s = s - 1
				else:
					new = new + colors[s].replace("#","[") + "]" + _
				s = s + 1
			clipboard.set("[c][b][efffff]" + new + msgb)
			if verbose: print "Copied"
			new = ""
			msgb = ""
	except Exception as e:
		if verbose: print traceback.print_exc(file=sys.stdout)
		pass 
開發者ID:RussianOtter,項目名稱:networking,代碼行數:34,代碼來源:ColorTerminal.py

示例5: liner

# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import set [as 別名]
def liner():
	# so many lines!
	colors = ["#u","#/u","#u","#/u"]
	s = 0
	new = ""
	msgb = ""
	try:
		while 1:
			sys.stderr = msg = unicode(raw_input("Message: "))
			if msg == "!quit":
				if verbose: print "Stopped"
				break
			if len(msg) >= 100:
				msgb = msg[100:]
				msg = msg[:100]
			msg = list(msg)
			for _ in msg:
				if s == len(colors):
					s = 0
				if _ == " ":
					new = new + " "
					s = s - 1
				else:
					new = new + colors[s].replace("#","[") + "]" + _
				s = s + 1
			clipboard.set("[c][b][efffff]" + new + msgb)
			if verbose: print "Copied"
			new = ""
			msgb = ""
	except Exception as e:
		if verbose: print traceback.print_exc(file=sys.stdout)
		pass 
開發者ID:RussianOtter,項目名稱:networking,代碼行數:34,代碼來源:ColorTerminal.py

示例6: l33t

# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import set [as 別名]
def l33t():
	try:
		while 1:
			sys.stderr = msg = unicode(raw_input("Message: "))
			if msg == "!quit":
				if verbose: print "Stopped"
				break
			clipboard.set("[c][b][00ff00]"+unicode(msg.replace("a","4").replace("e","3").replace("t","7").replace("i","1").replace("o","0").replace("B","8").replace("s","5")))
			if verbose: print "Copied"
	except Exception as e:
		if verbose: print traceback.print_exc(file=sys.stdout)
		pass 
開發者ID:RussianOtter,項目名稱:networking,代碼行數:14,代碼來源:ColorTerminal.py

示例7: fancy

# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import set [as 別名]
def fancy(cl="ord"):
	# Font Types
	# ord - Ordered cycle through all font options
	# ran - Random choice of font options
	# rancycle - Randomly choose 1 font to cycle with
	# 1 - font 1, Candy-Cain-Like font structure
	# 2 - font 2, blue and yellow lightning-like font structure
	# 3 - font 3, black and yellow storm font structure
	# 4 - font 4, light prism font structure
	fa1 = "[c][b][efffff]-[ff0000]=[efffff]-[ff0000]=[efffff]- %s [efffff]-[ff0000]=[efffff]-[ff0000]=[efffff]-" 
	fa2 = "[c][b][0000ff]>[ffff00]> [0000ff]>[ffff00]>[efffff] %s [ffff00]<[0000ff]< [ffff00]<[0000ff]<"
	fa3 = "[c][b][ffff00]+[585858]-[484848]=[585858]-[ffff00]+[efffff] %s [ffff00]+[585858]-[484848]=[585858]-[ffff00]+"
	fa4 = "[c][b][9f9f9f]|[ffff00]: : :[9f9f9f]| [ffff00]-[efffff] %s [ffff00]- [9f9f9f]|[ffff00]: : :[9f9f9f]|"
	ord = [fa1,fa2,fa3,fa4]
	if cl == "ord":
		try:
			while 1:
				for _ in ord:
					sys.stderr = msg = unicode(raw_input("Message: "))
					if msg == "!quit":
						if verbose: print "Stopped"
						break
					clipboard.set(_ %(msg))
					if verbose: print "Copied"
		except Exception as e:
			if verbose: print traceback.print_exc(file=sys.stdout)
			pass
	if cl == "ran":
		try:
			while 1:
				_ = random.choice(ord)
				sys.stderr = msg = unicode(raw_input("Message: "))
				if msg == "!quit":
					if verbose: print "Stopped"
					break
				clipboard.set(_ % (msg))
				if verbose: print "Copied"
		except Exception as e:
			if verbose: print traceback.print_exc(file=sys.stdout)
			pass 
開發者ID:RussianOtter,項目名稱:networking,代碼行數:42,代碼來源:ColorTerminal.py

示例8: RegularMulticolor

# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import set [as 別名]
def RegularMulticolor(colors):
	s = 0
	new = ""
	msgb = ""
	try:
		while 1:
			sys.stderr = msg = unicode(raw_input("Message: "))
			if msg == "!quit":
				if verbose: print "Stopped"
				break
			msg = unicode(msg)
			if len(msg) >= 22:
				msgb = msg[22:]
				msg = msg[:22]
			msg = list(msg)
			for _ in msg:
				if s == len(colors):
					s = 0
				if _ == " ":
					new = new + " "
					s = s - 1
				else:
					new = new + colors[s].replace("#","[") + "]" + _
				s = s + 1
			clipboard.set("[c][b]" + new + msgb)
			if verbose: print "Copied"
			new = ""
			msgb = ""
			s = 0
	except Exception as e:
		if verbose: print traceback.print_exc(file=sys.stdout)
		pass 
開發者ID:RussianOtter,項目名稱:networking,代碼行數:34,代碼來源:ColorTerminal.py

示例9: clipboard_set

# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import set [as 別名]
def clipboard_set(s):
        """
        Set the clipboard content.
        :param s: string to set
        :type s: six.text_type
        """
        # TODO: non-unicode support
        assert isinstance(s, six.text_type)
        clipboard.set(s)
    
    # -------------- pip ---------------------- 
開發者ID:ywangd,項目名稱:stash,代碼行數:13,代碼來源:libdist.py

示例10: main

# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import set [as 別名]
def main():
    if appex.is_running_extension():
        url = appex.get_url() or appex.get_text()
    else:
        import console

        try:
            url = console.input_alert('Enter URL').strip()
            if not url:
                return
        except KeyboardInterrupt:
            return

    print(f'Searching for <code> elements at {url}')
    try:
        elements = get_code_elements(url)

        if not elements:
            print(f'No <code> elements found')
            return

        result = '\n\n'.join([
            f'# <code> element no {idx+1}\n\n' + code
            for idx, code in enumerate(elements)
        ])

        clipboard.set(result)
        print(result)
        print(f'{len(elements)} <code> element(s) copied to the clipboard')

    except Exception as e:
        print(f'Failed to get <code> element values: {e}') 
開發者ID:zrzka,項目名稱:blackmamba,代碼行數:34,代碼來源:forum-copy-code.py

示例11: run

# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import set [as 別名]
def run(self, input):
		clipboard.set(input.value)
		self.status = 'complete' 
開發者ID:khilnani,項目名稱:pythonista-scripts,代碼行數:5,代碼來源:SetClipboardText.py

示例12: copy

# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import set [as 別名]
def copy(self):
        import clipboard
        i=editor.get_selection()
        t=editor.get_text()
        clipboard.set(t[i[0]:i[1]]) 
開發者ID:khilnani,項目名稱:pythonista-scripts,代碼行數:7,代碼來源:editmenu.py

示例13: cut

# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import set [as 別名]
def cut(self):
        import clipboard
        i=editor.get_selection()
        t=editor.get_text()
        clipboard.set(t[i[0]:i[1]])
        editor.replace_text(i[0],i[1], '')
        editor.set_selection(i[0],i[0]) 
開發者ID:khilnani,項目名稱:pythonista-scripts,代碼行數:9,代碼來源:editmenu.py

示例14: main

# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import set [as 別名]
def main():
	filename = editor.get_path()
	if not filename:
		dialogs.hud_alert('No file selected', 'error')
		return
	pyui_filename = os.path.splitext(filename)[0] + '.pyui'
	if not os.path.exists(pyui_filename):
		folder = os.path.split(filename)[0]
		files = os.listdir(folder)
		files = [f for f in files if f.endswith('.pyui')]
		if not files:
			dialogs.hud_alert('No pyui files found', 'error')
			return
		selected_pyui = dialogs.list_dialog('Select pyui file', files)
		if not selected_pyui:
			return
		pyui_filename = os.path.join(folder, selected_pyui)
	with open(pyui_filename, 'rb') as f:
		pyui = f.read()
	compressed = base64.b64encode(bz2.compress(pyui)).decode('utf-8')
	wrapped = '\n'.join(textwrap.wrap(compressed, 70))
	code = """\
data = '''\\\n%s
'''
import ui
import bz2
from base64 import b64decode
pyui = bz2.decompress(b64decode(data))
v = ui.load_view_str(pyui.decode('utf-8'))
""" % (wrapped,)
	clipboard.set(code)
	dialogs.hud_alert('Code copied', 'success') 
開發者ID:khilnani,項目名稱:pythonista-scripts,代碼行數:34,代碼來源:EmbedPyui.py

示例15: anchor

# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import set [as 別名]
def anchor(self, sender):
		templ = " <a name='#'></a>"
		(start, end) = self.markup.selected_range
		link_label = self.markup.text[start:end]
		link_name = quote(self.markup.text[start:end])
		templ = templ.replace('#', link_name)
		self.markup.replace_range((end, end), templ)
		link = "[" + link_label + "](#" + link_name + ")"
		clipboard.set(link) 
開發者ID:khilnani,項目名稱:pythonista-scripts,代碼行數:11,代碼來源:MarkdownView.py


注:本文中的clipboard.set方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。