title: Hide tkinter window in system tray
body: <p>I am making a program that reminds me birthday of my friends so that I don't forget to wish them. For that I made two two tkinter windows:</p>
  
  <pre><code>1. First one is for entering name and birth date   
  2. Second one is for reminding their birthday
  </code></pre>
  
  <p>I have no problem with second tkinter window but I wanted to hide the first tkinter window in system tray so that it don't open in startup but it do have ability to open whenever I click to the program icon like some programs do eg: f.lux, Internet Downloader Manager(IDM), Windows Antivirus, etc.</p>
  
  <p>For that I have did:</p>
  
  <pre><code>   root.deiconify()
  
     root.iconify()
  </code></pre>
  
  <p>which nearly solved by problem (but only nearly). It hid my tkinter window but showed icon in taskbar which I don't want.</p>
  
  <p>I want both tkinter window and its icon hidden (from the taskbar) but I want to view tkinter window icon in system tray so that I can open program anytime I want to.</p>
  
  <p><strong>I want my program to be displayed here by hiding window</strong></p>
  
  <p><a href="https://i.stack.imgur.com/87WMM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/87WMM.png" alt="SYSTEM TRAY"></a></p>
  
  <p><strong>My CODE</strong></p>
  
  <pre><code>from tkinter import *
  
  
  def when_clicked(event):
      """function that gets called whenever entry is clicked"""
      if entry_area_two.get() == 'DD-MM':
          entry_area_two.delete(0, "end")  # delete all the text in the entry
          entry_area_two.insert(0, '')  # Insert blank for user input
          entry_area_two.config(fg='black')
  
  
  def when_not_clicked(event):
      if entry_area_two.get() == '' or entry_area_two.get() == ' ':
          entry_area_two.insert(0, 'DD-MM')
          entry_area_two.config(fg='grey')
  
  
  def when_clicked_another(event):
      """function that gets called whenever entry is clicked"""
      if entry_area_one.get() == 'Name':
          entry_area_one.delete(0, "end")  # delete all the text in the entry
          entry_area_one.insert(0, '')  # Insert blank for user input
          entry_area_one.config(fg='black')
  
  
  def when_not_clicked_another(event):
      if entry_area_one.get() == '' or entry_area_one.get() == ' ':
          entry_area_one.insert(0, 'Name')
          entry_area_one.config(fg='grey')
  
  
  def get():
      name = entry_area_one.get()
      date = entry_area_two.get()
  
      print(name, date)
  
  
  def main():
      global entry_area_one
      global entry_area_two
  
      root = Tk()
      root.resizable(0, 0)
  
      screen_width = root.winfo_screenwidth()
      screen_height = root.winfo_screenheight()
  
      tkinter_width, tkinter_height = 300, 280
      pos_x, pos_y = screen_width - 800, screen_height // 5
  
      root.geometry('{}x{}+{}+{}'.format(tkinter_width, tkinter_height, pos_x, pos_y))
  
     text_one = Label(root, text='Name')
     text_two = Label(root, text='Date of Birth')
  
     entry_area_one = Entry(root, bd=2, width=40)
     entry_area_two = Entry(root, bd=2, width=40)
  
     add_button = Button(root, text='ADD', height=2, width=34, command=get)
     close_button = Button(root, text='CLOSE', height=2, width=34, command=root.destroy)
  
     text_one.pack()
     text_two.place(x=18, y=80)
  
     entry_area_one.insert(0, 'Name')
     entry_area_one.bind('&lt;FocusIn&gt;', when_clicked_another)
     entry_area_one.bind('&lt;FocusOut&gt;', when_not_clicked_another)
     entry_area_one.config(fg='grey')
     entry_area_one.pack()
  
     entry_area_two.insert(0, 'DD-MM')
     entry_area_two.bind('&lt;FocusIn&gt;', when_clicked)
     entry_area_two.bind('&lt;FocusOut&gt;', when_not_clicked)
     entry_area_two.config(fg='grey')
     entry_area_two.place(x=25, y=125)
  
     add_button.place(x=24, y=170)
     close_button.place(x=24, y=220)
  
     text_one.config(font=("Courier", 25), fg='Black', bg='grey')
     text_two.config(font=("Courier", 25), fg='Black', bg='grey')
  
     root.configure(background='grey')
     root.deiconify()   # This didn't worked
     root.iconify()     # This didn't worked
     root.mainloop()
  </code></pre>
  
  <p><strong>Can I hide my tkinter window in system tray?</strong></p>