title: Inactive window -Tkinter
body: <p>As new to tkinter, I am working on an <strong>application</strong> in which pressing f5 refreshes the page of chrome. Instead of using pyautogui (which is very weird) to change the tab from application to chrome and then press F5. <em>I need to know that is there a way that if chrome is active and application is in-active and by pressing the button on the app will stay make the chrome active and perform f5(refreshing)?</em></p>
  <p><strong>here is my code:</strong></p>
  <pre><code>import tkinter as tk
  from tkinter import ttk
  import pyautogui as pg
  
  def F5(event):
      
      pg.hotkey('f5')
      print('pressed f5')
     
  
  root = tk.Tk()
  root.attributes(&quot;-topmost&quot;, True)
  root.attributes(&quot;-alpha&quot;, 0.3)
  root.overrideredirect(True)
  
  button = ttk.Button(root, text = 'F5',state='active')
  
  button.bind('&lt;Button-1&gt;',F5)
  button.pack(side = tk.TOP)
  
  
  root.geometry('+1+78')
  root.mainloop()
  </code></pre>