0

I'm working on a Python tkinter app on mac, and have run into a strange issue. Though clicking on buttons call their functions as they should, I've found that the buttons don't flash a different color when the mouse is depressed (which would be helpful to visually indicate that the button has registered as clicked).

However, after I open a file browser with tk.filedialog.askdirectory(), all buttons in the app turn blue while the mouse is depressed.

Can you give me any insight as to why this is, and could you let me know how to make this occur by default?

Edit: Here's an example of a simple test program I made, in which the same issue appears:

import tkinter as tk
from tkinter import filedialog as fd

def addText():
    label = tk.Label(labelsFrame, text="This is text.")
    label.pack()

def openBrowser():
    fd.askdirectory()

root = tk.Tk()

buttonsFrame = tk.Frame(root)
buttonsFrame.grid(row=0, column=0)

labelsFrame = tk.Frame(root)
labelsFrame.grid(row=1, column=0)

button1 = tk.Button(buttonsFrame, text="Add Text", command=addText)
button1.grid(row=0, column=0)

button2 = tk.Button(buttonsFrame, text="Open Browser", command=openBrowser)
button2.grid(row=0, column=1)

tk.mainloop()
ianfort
  • 3
  • 2

0 Answers0