Edit - and add code I'm not sure that proc.communicate was needed, one of the tips I found I was tired last night and did not think too much before asking questions.)
I should add that I was an experienced encode (mechanical engineer) I'm not likely to tell me from my code
I have a A subprocess is a call to call
Subprocess (screenshot - CMD.exe) creates a PNG of a crop screen screen but it won
this is actually the file Prepares until there is no error or if the button click event is over.
From this, I think the subproduct does not really work unless the event is finished
I want to call this process several times after pressing a button and
If I use proc.wait (), then the process will hang indefinitely after
to move the files that are produced after each one. How to stop To take a single image called 'File Name', keep #Function and keep it in the directory 'DIR' Diff Leimage (DIR, Filename): # Calculation of Capture to get the full display window. clientRect = win32gui.GetClientRect (win32gui.GetForegroundWindow ()) windowRect = win32gui.GetWindowRect (win32gui.GetForegroundWindow ()) print (windowRect) windowSize = [windowRect [2] -windowRect [0], windowRect [3] -windowRect [1] ] print (windowSize) Print (clientRect) diffSize = [windowSize [0] -clientRect [2], windowSize [1] - clientRect [3]] lrbBorder = diffSize [0] / 2 topBorder = diffSize [1] - lrbBorder print ( "Sizediff =" + level (Diffsize)) Indonme = Vin32guikgetvindotest (Vin32guikgetforgrundvindo ()) Handland = Vin32guikgetforgrundvindo () Leftmar = Desiganlabelkgetposisn () [0] + Lrbboarder Topmar = Desiganlabelkgetposisn () [1 ] + Top border + design label. Gates () [1] Correct mine = left + + + scene. Wide Batman = Topmara + view H Eight Margin = [Left Marker, Topmor, Right Meyer, Bottermarh] Print (Margin) # Print the View #command_line = r "screenshot-cmd -wt '" + windowName + "' -rc" + str (margin [0 ] + Str (margin [1]) + + + str (margin [2]) + "[strings] [+] + [str (margin [3]) +" -o "+ filename Command_line = r "screenshot-cmd -wt '" + windowName + "' -rc" + str (margin [0]) + "str (margin [1]) +" str (margin [2]) + "+ Str (margin [3]) +" -o "+ filename print (command_line) args = shakes. Split (command_line) proc = subprocess .Popen (args) proc.wait () Wx.Yield () if not os.path.isdir (dir): os.makedirs (dir) newPath = os.path.join (dir, fileName) if os.path.exists (newpath): os.remove (newpath) Oldpath = os.path.join (os.getcwd (), filename) print ("old path:" + old page) print ("exists:" + str (os.path.exists (oldPath)) shutil.move (OldPath, Newpath) called the return #event 'TakeTenImag' button takeTenImgE (evt) def to click: global designNo global workingDirectory global numDesigns fileNameRoot = "test_" fil EExtention = ".png" # Check that at least 10 designs If the numDesigns & gt; 9 and os.path.exists: Direct Directory Path for Direct Dir = os.path.join (Working Directory, "Images") # Range (10) in X for each design: print (" Design = "+ Str (designNo)) fileName = fileNameRoot + str (designNo) + File Specified Print (" ------------------ ") Print (" x = "+ str (x) + "" + filename) # image forming) and (name of the next design wx.PostEvent (forwardDesign, wx.CommandEvent (wx.wxEVT_COMMAND_BUTTON_CLICKED, forwardDesign.GetId (to dir) takeImage (dir, file ) #move) Print save wx. Yield () Int ( "Design =" + straw (not design)) Left Leftinm = Wxkbutton (p, label = "Ten images back, pause = (Rb + Visskel text. Getsijh () [0] +10, Leimji .GetPosition () [1] 5 + takeImg.GetSize () [1]), size = (100,30)) takeTenImg.Bind (wx.EVT_BUTTON, takeTenImgE)
No comments:
Post a Comment