|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#!/usr/bin/python
# _*_ coding=utf-8 _*_
import tkinter
from subprocess import Popen
import pyautogui
import openpyxl as vb
import openpyxl.utils as vbu
import pyperclip
import cv2
import pygame
import threading
from time import sleep
pyautogui.FAILSAFE=True
def thread_it(func,*args):
t = threading.Thread(target=func,args=args)
t.setDaemon(True)
t.start()
class Caozuo():
def __init__(self,getwsrow):
self.l=getwsrow
def get_pz(self):
m=[b for b in str(self.l[2])]
sleep(0.2)
# os.system("pause")
if m[0] == '1':
print(self.l[0],self.l[2],self.l[8],self.l[9])
elif m[0] == '5':
print(self.l[0],self.l[2],self.l[4],self.l[8],self.l[9])
elif m[0] == '7':
print(self.l[0],self.l[2],self.l[4],self.l[8],self.l[9])
else :
print(self.l[0],self.l[2],self.l[3],self.l[4],self.l[8],self.l[9])
def run(worksheet):
pznum = 0
key = 0
for row in list(worksheet.rows)[1:]:
# 按行 把每列的值 赋值到L数组
wsrow=[c.value for c in row]
input_kb = cv2.waitKey(1) & 0xFF
if input_kb == ord(' '):
sleep(0.2)
print('paused')
cv2.waitKey(0)
print('continued')
else :
if wsrow[0] is not None:
number = Caozuo(wsrow)
number.get_pz()
else:
pznum +=1
print('完成第',pznum,"张凭证录入")
exit()
def star():
thread_it(run,ws)
def pause():
def stop():
top.destroy()
if __name__=="__main__":
wb=vb.load_workbook('序时账.xlsx')
ws=wb.active
top = tkinter.Tk()
top.title("金算盘自动做账")
thelable=tkinter.Label(top,text="需要结束程序,请先按下空格暂停")
top.geometry('300x200') # Size 200, 200
startButton = tkinter.Button(top, height=3, width=20, text ="开始",
command = star)
pauseButton = tkinter.Button(top, height=3, width=20, text ="暂停",
command = pause)
stopButton = tkinter.Button(top, height=3, width=20, text ="结束",
command = stop)
thelable.pack()
startButton.pack()
pauseButton.pack()
stopButton.pack()
top.mainloop() |
|