1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #!/usr/bin/python import os import json,subprocess import time p = "/alt/sc/Tools/Selection/size.conf" def select_size(): os.system("sleep 0.2; selectit > %s" % p) time.sleep(0.1) with open(p, 'r') as f: w,h,x0,y0 = [int(x) for x in f.read().split()] if (w+1) % 5 == 0: w = w + 1 if (h+1) % 5 == 0: h = h + 1 with open(p, 'w') as f: f.write(' '.join([str(x) for x in [w,h,x0,y0]])) #popen = subprocess.Popen("sleep 0.2; selectit",stdout=subprocess.PIPE) #result = popen.stdout.readline() #w,h,x0,y0 = [int(i) for i in result.split()] #return {'x0':x0,'y0':y0, # 'w':w, 'h':h} select_size() #sizes=select_size() #with open(p, "w") as f: # json.dump(sizes,f) |
This paste expires on 2016-03-15 12:24:49. View raw. Pasted through web.