如何使用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 (将#修改为@)