Python Tkinter Window not closing
<p>So I was writing a short code to test something when I noticed this interesting behaviour. </p>

<pre><code>import tkinter
from tkinter import *

master=tkinter.Tk()
master.geometry("800x850+0+0")
master.configure(background="lightblue")

def d():
    master.destroy()

button=Button(master, text="asdf", command=d).pack()

master.mainloop()
</code></pre>

<p>The button closes the window as expected, but when I click on the red button on the top left button (from the actual window, not tkinter), the program gets stuck and doesn't respond. 
However, when I change the code to remove the text in the button as follows:</p>

<pre><code>import tkinter
from tkinter import *

master=tkinter.Tk()
master.geometry("800x850+0+0")
master.configure(background="lightblue")

def d():
    master.destroy()

button=Button(master, command=d).pack()

master.mainloop()
</code></pre>

<p>It now works perfectly fine. Both the tkinter button in the window and the red button from the actual window close the window as expected.
Why does this happen?
I am using python 3.5 on Mac, in case this matters.</p>

<p>I tried it out on some of my friends computers and they didn't have this issue, so it appears that it was just a hardware specific problem.</p>

python tkinter window