当前位置: 首页>>代码示例>>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;未经允许,请勿转载。