微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何使用pickle保存锚数据python

如何解决如何使用pickle保存锚数据python

我想用pickle来保存锚数据。目前我正在使用锚点将鼠标点保存在我的屏幕上,以便您以后可以单击它们。我想制作另一个运行发件人功能的脚本。 (它是一个在 snapchat 上发送图片的机器人)sender 函数需要填充锚值,所以我需要用 pickle 访问它们。这是代码

import pyautogui as pag
import sys,json,requests,keyboard,time
import pickle

anchorNames = ["Camera Button","Picture button","Pick","Group Button","Select Button","Send Button"]
anchors = []


anchorsFulfilled = 0
anchorsrequired  = len(anchorNames)

print(":: Click enter when your mouse is over '{0}' ::".format(anchorNames[anchorsFulfilled]))

while anchorsFulfilled != anchorsrequired:
    if keyboard.read_key() == "enter":

        mousePositionNow = pag.position()
        anchors.append(mousePositionNow)
        print("Successfully captured mouse coordinates.\n")
        anchorsFulfilled += 1
        if anchorsFulfilled == anchorsrequired: break
        print(":: Click enter when your mouse is over '{0}' ::".format(anchorNames[anchorsFulfilled]))
        time.sleep(1)

print("Cords captured: {0}\n".format(anchors))
print("Go Back To Picture Page And Press Enter to Start")



def sender():
    global anchors
    cameraButton,pictureButton,pick,groupButton,selectbutton,sendButton = anchors

    pag.moveto(pictureButton)
    pag.click(pictureButton)
    time.sleep(1)

    pag.moveto(pick)
    pag.click(pick)
    time.sleep(1)

    pag.moveto(groupButton)
    pag.click(groupButton)
    time.sleep(1)

    pag.moveto(selectbutton)
    pag.click(selectbutton)
    time.sleep(1)

    pag.moveto(sendButton)
    pag.click(sendButton)
    time.sleep(1)

    pag.moveto(cameraButton)
    pag.click(cameraButton)


time.sleep(1)
if keyboard.read_key() == "enter":
    sender()

我想在另一个 python 脚本中运行发件人。这是代码

from SnapBot import sender
import time
import pickle


time.sleep(3)
sender()

如何使用pickle访问锚数据?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。