아래 코드는 code.py
파일에 있습니다. 파일을 편집하려면 IDLE
을 사용하고 있습니다. 내가 Run>Run Module
을 클릭하면 나는 오류 얻을 :IDLE 하위 프로세스 시작 오류
"IDLE's subprocess didn't make connection. Either IDLE can't start a subprocess of personal firewall software is blocking the connection."
나는 윈도우 7 얼티밋 64 비트를 사용하고,하지만 나는 설치된 파이썬 2.7의 32 비트 버전이 있습니다.
나는이 사이트와 다른 사이트의 솔루션을 찾았지만 모두 tkinter.py
(이게 뭔지는 모르겠다)을 삭제하거나 내 방화벽을 끄는 것이 좋습니다. 방화벽이 아닌 Microsoft Security Essentials
)
#Globals
#-------------------
x_pad = 476
y_pad = 444
import ImageGrab
import os
import time
import win32api, win32con
def screenGrab():
box = (x_pad+1,y_pad+1,x_pad+641,y_pad+480)
im = ImageGrab.grab(box)
im.save(os.getcwd() + '\\full_snap__' + str(int(time.time())) +
'.png', 'PNG')
def main():
pass
if __name__ == '__main__':
main()
def leftClick():
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0)
time.sleep(.1)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0)
print 'Click.' #completely optional. But nice for debugging purposes.
def leftDown():
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0)
time.sleep(.1)
print 'left Down'
def leftUp():
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0)
time.sleep(.1)
print 'left release'
def mousePos(cord):
win32api.SetCursorPos((x_pad + cord[0], y_pad + cord[1])
def get_cords():
x,y = win32api.GetCursorPos()
x = x - x_pad
y = y - y_pad
print x,y
IDLE은 한 번 (다른 python 파일과 함께) 작업했거나 처음으로 (컴퓨터에서) 사용 했습니까? –
이 오류는 실행> 모듈 실행을 클릭하는 경우에만 표시됩니다. Python 파일을 두 번 클릭하면 코드가 의도 한대로 실행됩니다. –
질문은 IDLE에 관한 것입니다. IDLE Run/Run 모듈을 통해 다른 파이썬 모듈을 runned 시켰습니까? 그렇지 않다면 IDLE이 핵심 Python 배포판의 일부로 전체 Python을 제거하고 다시 설치하려고 할 수 있습니다. –