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


Python PyKeyboard.press_keys方法代码示例

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


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

示例1: on_End_combo

# 需要导入模块: from pykeyboard import PyKeyboard [as 别名]
# 或者: from pykeyboard.PyKeyboard import press_keys [as 别名]
def on_End_combo():
	logging.info(30*'_' + " on_End_combo")
	k = PyKeyboard()
	#抬起功能按键Ctrl,否则End效果会变为Ctrl+End效果
	k.release_key(k.control_key)
	k.press_keys([k.end_key, ';', k.enter_key])
	return False
开发者ID:gbwgithub,项目名称:g-py,代码行数:9,代码来源:hook_handler.py

示例2: combo

# 需要导入模块: from pykeyboard import PyKeyboard [as 别名]
# 或者: from pykeyboard.PyKeyboard import press_keys [as 别名]
def combo(*arg):

    theCombo = arg[:-1]
    theVelocity = arg[-1] # not used

    k = PyKeyboard()
    k.press_keys(theCombo)
开发者ID:jonathanlurie,项目名称:MidiCombo,代码行数:9,代码来源:keyboard.py

示例3: callSequence

# 需要导入模块: from pykeyboard import PyKeyboard [as 别名]
# 或者: from pykeyboard.PyKeyboard import press_keys [as 别名]
def callSequence(*args):
    m = PyMouse()
    k = PyKeyboard()

    print args
    #k.press_keys(args)
    #k.type_string(args[0])
    keys = ["cmd", "a"]

    #callArray(keys)

    k.press_keys(keys)
开发者ID:jonathanlurie,项目名称:pythonStuff,代码行数:14,代码来源:test1.py

示例4: open

# 需要导入模块: from pykeyboard import PyKeyboard [as 别名]
# 或者: from pykeyboard.PyKeyboard import press_keys [as 别名]
    #logFile = "%r.pcap" %fileName
    #cmd = "sudo ./flow_track.sh %r %r" %(outputDir, logFile)
    #os.system(cmd)

    with open(open_file, "w") as myfile:
        for run in xrange(0, iterNum):
            # for wi in xrange(0,len(websites)):
            for wi in xrange(0+startNum-1, webNum+startNum-1):
                website = websites[wi]
                c_time = datetime.datetime.now().time()
                c_time = c_time.isoformat()
                logstamp = "%s,%s\n" % (c_time, website)

                if DEBUG3: print "%s-run%d-web%d: %s" % (c_time, run, wi, website)
                myfile.write(logstamp)

                #cmd = "sudo ./flow_track.sh %s %s %d %s" %(outputDir,fileName, openItvl, website)
                #os.system(cmd)

                cmd = "open -a /Applications/%s http://%s &" %(default_explore,
                                                                   website)
                os.system(cmd)

                time.sleep(openItvl)

                k.press_keys(['Command','w'])
                time.sleep(closeItvl)
    #if DEBUG2: print "Kill tcpdump"
    #cmd = "pkill -9 -f tcpdump"
    #os.system(cmd)
开发者ID:yichao0319,项目名称:mag_security,代码行数:32,代码来源:visit_websites.py

示例5: locateball

# 需要导入模块: from pykeyboard import PyKeyboard [as 别名]
# 或者: from pykeyboard.PyKeyboard import press_keys [as 别名]
        gameboard[listnumber-1][whichracket]='|'
    if direction=='down':
        gameboard[listnumber+1][whichracket]='|'
    gameboard[listnumber][whichracket]=''
def locateball():
    listnumber=-1
    for elem in gameboard:
        listnumber=listnumber+1
        listindex=-1
        for elem in elem:
            listindex=listindex+1
            if elem=='*':
                return([listnumber,listindex])
def locateracket(whichracket):
    listnumber=-1
    for elem in gameboard:
        listnumber=listnumber+1
        if elem[whichracket]=='|':
            break
    return(listnumber)

for elem in range(50):
    updateboard()
    time.sleep(0.001)
    moveball([round(elem/7),round(elem/9)])
    updateboard()
    

    
keyboard.press_keys(['Command','k'])
开发者ID:orcapt,项目名称:orca_python,代码行数:32,代码来源:pong.py

示例6: range

# 需要导入模块: from pykeyboard import PyKeyboard [as 别名]
# 或者: from pykeyboard.PyKeyboard import press_keys [as 别名]
                print "                        [email protected]@@@0oo..                      [email protected]@@@00o."
                time.sleep(0.02)
                print "                            [email protected]@@@@[email protected]@@@@00o."
                time.sleep(0.02)
                print "                                [email protected]@@@@@@@@@@@@@@@@@@@000oo."
                time.sleep(0.02)
                print "                                      ...oooooooooooooo..."
                for i in range(rows):
                    time.sleep(0.03)
                    print ""

            k.type_string('htop -d 50')
            time.sleep(0.1)
            k.tap_key('Return')
            time.sleep(0.01)
            k.press_keys(['Alt_L', '\\'])
            time.sleep(0.1)
            k.press_keys(['Alt_L', 'h'])
            time.sleep(0.01)
            k.press_keys(['Alt_L', '-'])
            time.sleep(0.1)
            k.type_string('mutt')
            time.sleep(0.01)
            k.tap_key('Return')
            time.sleep(0.01)
            k.press_key('Alt_L')
            k.tap_key(character='Up', n=8)
            time.sleep(0.01)
            k.tap_key('-')
            time.sleep(0.1)
            k.tap_key(character='Down', n=2)
开发者ID:mamiu,项目名称:dotfiles_ubuntu,代码行数:33,代码来源:init_terminator.py

示例7: combo

# 需要导入模块: from pykeyboard import PyKeyboard [as 别名]
# 或者: from pykeyboard.PyKeyboard import press_keys [as 别名]
def combo(*arg):
    k = PyKeyboard()
    k.press_keys(arg)
开发者ID:jonathanlurie,项目名称:pythonStuff,代码行数:5,代码来源:keyboard.py

示例8: int

# 需要导入模块: from pykeyboard import PyKeyboard [as 别名]
# 或者: from pykeyboard.PyKeyboard import press_keys [as 别名]
    fileName = sys.argv[1]
    iterNum = int(sys.argv[2])
    webNum = int(sys.argv[3])

    force_utf8_hack()

    if DEBUG2: print "Load Web Sites"
    #websites = list_data.load_data(input_dir + filename)
    url_file = open(input_dir+filename,"r")
    websites = url_file.readlines()

    if DEBUG2: print "  # web sites: %d" % (len(websites))
    open_file = "%s/%s.web_time.txt" %(outputDir,fileName)
    with open(open_file, "w") as myfile:
        for run in xrange(0, iterNum):
            for wi in xrange(0, webNum):
                website = websites[wi]
                print website
                c_time = datetime.datetime.now().time()
                c_time = c_time.isoformat()
                logstamp = "%s,%s\n" % (c_time, website)

                if DEBUG3: print "%s-run%d-web%d: %s" % (c_time, run, wi, website)
                myfile.write(logstamp)


                p = Popen(['start', 'chrome', website],stdout=PIPE, shell=True)
                time.sleep(openItvl)
                k.press_keys([k.control_key,'w'])
                time.sleep(closeItvl)
开发者ID:yichao0319,项目名称:mag_security,代码行数:32,代码来源:visit_websites_windows.py

示例9: command

# 需要导入模块: from pykeyboard import PyKeyboard [as 别名]
# 或者: from pykeyboard.PyKeyboard import press_keys [as 别名]

#.........这里部分代码省略.........
            city = ""
            for ent in doc.ents:
                if ent.label_ == "GPE":
                    city += ' ' + ent.text
            city = city.strip()
            if city:
                owm = pyowm.OWM("16d66c84e82424f0f8e62c3e3b27b574")
                reg = owm.city_id_registry()
                weather = owm.weather_at_id(reg.ids_for(city)[0][0]).get_weather()
                fmt = "The temperature in {} is {} degrees celsius"
                msg = fmt.format(city, weather.get_temperature('celsius')['temp'])
                userin.execute([" "], msg)
                userin.say(msg)
                return True
        if h.check_nth_lemma(0, "keyboard") or h.check_nth_lemma(0, "type"):
            n = len(doc[0].text) + 1
            with nostdout():
                with nostderr():
                    k = PyKeyboard()
                    for character in com[n:]:
                        k.tap_key(character)
                    k.tap_key(" ")
            return True
        if h.directly_equal(["enter"]) or (h.check_adj_lemma("new") or h.check_noun_lemma("line")):
            with nostdout():
                with nostderr():
                    k = PyKeyboard()
                    k.tap_key(k.enter_key)
            return True
        if h.check_adj_lemma("new") and h.check_noun_lemma("tab"):
            with nostdout():
                with nostderr():
                    k = PyKeyboard()
                    k.press_keys([k.control_l_key, 't'])
            return True
        if h.check_verb_lemma("switch") and h.check_noun_lemma("tab"):
            with nostdout():
                with nostderr():
                    k = PyKeyboard()
                    k.press_keys([k.control_l_key, k.tab_key])
            return True
        if h.directly_equal(["CLOSE", "ESCAPE"]):
            with nostdout():
                with nostderr():
                    k = PyKeyboard()
                    k.press_keys([k.control_l_key, 'w'])
                    k.tap_key(k.escape_key)
            return True
        if h.check_lemma("back") and h.max_word_count(4):
            with nostdout():
                with nostderr():
                    k = PyKeyboard()
                    k.press_keys([k.alt_l_key, k.left_key])
            return True
        if h.check_lemma("forward") and h.max_word_count(4):
            with nostdout():
                with nostderr():
                    k = PyKeyboard()
                    k.press_keys([k.alt_l_key, k.right_key])
            return True
        if h.check_text("swipe") or h.check_text("scroll"):
            if h.check_text("left"):
                with nostdout():
                    with nostderr():
                        m = PyMouse()
                        m.scroll(0, -5)
开发者ID:igorstarki,项目名称:Dragonfire,代码行数:70,代码来源:__init__.py

示例10: command

# 需要导入模块: from pykeyboard import PyKeyboard [as 别名]
# 或者: from pykeyboard.PyKeyboard import press_keys [as 别名]

#.........这里部分代码省略.........
                reg = owm.city_id_registry()
                try:
                    weather = owm.weather_at_id(reg.ids_for(city)[0][0]).get_weather()
                    fmt = "The temperature in {} is {} degrees celsius"
                    msg = fmt.format(city, weather.get_temperature('celsius')['temp'])
                    userin.execute([" "], msg)
                    return userin.say(msg)
                except IndexError:
                    msg = "Sorry, " + user_prefix + " but I couldn't find a city named " + city + " on the internet."
                    userin.execute([" "], msg)
                    return userin.say(msg)
        if (h.check_nth_lemma(0, "keyboard") or h.check_nth_lemma(0, "type")) and not args["server"]:
            n = len(doc[0].text) + 1
            with nostdout():
                with nostderr():
                    k = PyKeyboard()
                    if not self.testing:
                        for character in com[n:]:
                            k.tap_key(character)
                        k.tap_key(" ")
            return "keyboard"
        if (h.directly_equal(["enter"]) or (h.check_adj_lemma("new") and h.check_noun_lemma("line"))) and not args["server"]:
            with nostdout():
                with nostderr():
                    k = PyKeyboard()
                    if not self.testing:
                        k.tap_key(k.enter_key)
            return "enter"
        if h.check_adj_lemma("new") and h.check_noun_lemma("tab") and not args["server"]:
            with nostdout():
                with nostderr():
                    k = PyKeyboard()
                    if not self.testing:
                        k.press_keys([k.control_l_key, 't'])
            return "new tab"
        if h.check_verb_lemma("switch") and h.check_noun_lemma("tab") and not args["server"]:
            with nostdout():
                with nostderr():
                    k = PyKeyboard()
                    if not self.testing:
                        k.press_keys([k.control_l_key, k.tab_key])
            return "switch tab"
        if h.directly_equal(["CLOSE", "ESCAPE"]) and not args["server"]:
            with nostdout():
                with nostderr():
                    k = PyKeyboard()
                    if not self.testing:
                        k.press_keys([k.control_l_key, 'w'])
                        k.tap_key(k.escape_key)
            return "close"
        if h.check_lemma("back") and h.max_word_count(4) and not args["server"]:
            with nostdout():
                with nostderr():
                    k = PyKeyboard()
                    if not self.testing:
                        k.press_keys([k.alt_l_key, k.left_key])
            return "back"
        if h.check_lemma("forward") and h.max_word_count(4) and not args["server"]:
            with nostdout():
                with nostderr():
                    k = PyKeyboard()
                    if not self.testing:
                        k.press_keys([k.alt_l_key, k.right_key])
            return "forward"
        if (h.check_text("swipe") or h.check_text("scroll")) and not args["server"]:
            if h.check_text("left"):
开发者ID:ismlkrkmz,项目名称:Dragonfire,代码行数:70,代码来源:__init__.py


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