I'm trying to make a program that hides and shows all my desktop files (mac) by executing defaults write com.apple.finder CreateDesktop false #or 'true' to show my files killall Finder I'm using tkinker to make a gui but everytime I execute my code, it shows all my files(without me doing anything) then when I request it to hide all my files it did, but it doesn't show them again.
Code:
import os
import tkinter as tk
def hide():
os.system("defaults write com.apple.finder CreateDesktop false")
os.system("killall Finder")
def show():
os.system("defaults write com.apple.finder CreateDesktop true")
os.system("killall Finder")
root = tk.Tk()
frame = tk.Frame(root)
frame.pack()
button = tk.Button(frame,
text="Hide",
fg="red",
command=hide)
button.pack(side=tk.LEFT)
slogan = tk.Button(frame,
text="Show",
fg="blue",
command=show())
slogan.pack(side=tk.RIGHT)
root.mainloop()