<commit_before>import wx, ConfigParser, os, win32gui, win32process, win32con, subprocess, time

class OverlayFrame( wx.Frame )  :
 
    def __init__( self )  :
 
        wx.Frame.__init__( self, None, title="Transparent Window",
                           style=wx.DEFAULT_FRAME_STYLE | wx.STAY_ON_TOP )
 
        self.ShowFullScreen( True )
        self.alphaValue = 180
        self.SetTransparent( self.alphaValue )
                
    def OnCloseWindow( self, evt ) :
        self.Destroy()
    
#end OverlayFrame class
    
class RunProgram (object):
    def __init__ (self):
        config = ConfigParser.ConfigParser()
        config.readfp(open(r'config.ini'))
        path = config.get('Section', 'front_window')
        p = subprocess.Popen(path)
        self.pid = p.pid
        print "self.pid"
        print self.pid
        print
    
    def makeProgramInFront(self, pid):
        def callback(hwnd, _):
            ctid, cpid = win32process.GetWindowThreadProcessId(hwnd)
            print "cpid"
            print cpid
            if cpid == pid:
                win32gui.SetWindowPos(hwnd,win32con.HWND_TOPMOST,0,0,500,500,0)
                print "hwnd"
                print hwnd
                return False
            return True
        win32gui.EnumWindows(callback, None)

           
#end RunProgram class
#=======================================================
    
if __name__ == '__main__' :
    
    app = wx.App( False )
    frm = OverlayFrame()
    frm.Show()
    runP = RunProgram()
    time.sleep (2)
    runP.makeProgramInFront(runP.pid)
    windowList = []
    win32gui.EnumWindows(lambda hwnd, windowList: windowList.append((win32gui.GetWindowText(hwnd),hwnd)), windowList)
    print len(windowList)<commit_msg>if chrome has been already running, this will not work; if click on the transparent frame, chrome will not be seen<commit_after>import wx, ConfigParser, os, win32gui, win32process, win32con, subprocess, time

class OverlayFrame( wx.Frame )  :
 
    def __init__( self )  :
 
        wx.Frame.__init__( self, None, title="Transparent Window",
                           style=wx.DEFAULT_FRAME_STYLE | wx.STAY_ON_TOP )
 
        self.ShowFullScreen( True )
        self.alphaValue = 180
        self.SetTransparent( self.alphaValue )
                
    def OnCloseWindow( self, evt ) :
        self.Destroy()
    
#end OverlayFrame class
    
class RunProgram ():
    def __init__ (self):
        config = ConfigParser.ConfigParser()
        config.readfp(open(r'config.ini'))
        path = config.get('Section', 'front_window')
        p = subprocess.Popen(path)
        self.pid = p.pid
        print "self.pid", self.pid
        
    def makeProgramInFront(self, pid):
        def callback(hwnd, _):
            ctid, cpid = win32process.GetWindowThreadProcessId(hwnd)
            print ctid, cpid, hwnd
            if cpid == pid:
                win32gui.SetWindowPos(hwnd,win32con.HWND_TOPMOST,0,0,500,500,0)    
                return False
            return True
        try:
            win32gui.EnumWindows(callback, None)
        except:
            print "Error"
            

           
#end RunProgram class
#=======================================================
    
if __name__ == '__main__' :
    
    app = wx.App( False )
    frm = OverlayFrame()
    frm.Show()
    runP = RunProgram()
    time.sleep (3)
    runP.makeProgramInFront(runP.pid)
    windowList = []
    win32gui.EnumWindows(lambda hwnd, windowList: windowList.append((win32gui.GetWindowText(hwnd),hwnd)), windowList)
    print len(windowList)
{'fraction_non_alphanumeric': 0.12566322256352974, 'fraction_numerical': 0.01731359955319743, 'mean_word_length': 2.2096774193548385, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2041197', 'n_tokens_mistral': 1125, 'n_tokens_neox': 1078, 'n_words': 232}