'build of multiproccesed tkinter programme opens new windows , but idle doesn't

I have this programme that works as intended in idle. however my build with cx_freeze opens new windows each time i click go.

import time
from tkinter import *
from multiprocessing import Process

def dothing(): 
    print("yo   ")
    time.sleep(2)

def do_2_things():
    processes = []
    for i in range(2):
        p1 = Process( target = dothing , args = ())
        processes.append(p1)
    for proc in processes:
        proc.start()    
    for proc in processes:
        proc.join()
    print("done    ")

if __name__ == '__main__':
    window=Tk()     
    B = Button(window, text ="go", command = do_2_things)  
    B.place(x=10, y=10);
    window.mainloop();

Why does running it in idle behave differently from my build? how can I get it to stop opening new windows? ive been asking around with this problem for a while, please help.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source