title: How can I make events based on the active window? (python)
body: <p>How can I make it so that when a certain window is active, the resolution is 1440x1080, but if any other window is active the resolution is 1920x1080 in Python?</p>
  <p>(the comments are on purpose)
  I'm using tkinter and I've tried:</p>
  <pre><code>import subprocess
  import tkinter as tk
  
  window = tk.Tk()
  
  if tk.ACTIVE('notepad.exe') *res changing command*
  else *res changing command*
  
  # def setresEvent(event):
      
  
  def startwinexpEvent(event):
      subprocess.call(['C:\\Users\\VBucks\\Workspaces\\winexp\\winexp.exe'])
  
  #setRes = tk.Button(
     # text='Click me!',
     # height=28,
     # width=32,
     # bg='black',
     # fg='white',
  #)
  # setRes.bind('&lt;Button-1&gt;', setresEvent)
  #setRes.pack()
  
  startwinExp = tk.Button(
      text='Start winexp',
      height=28,
      width=32,
      bg='black',
      fg='white',
  )
  startwinExp.bind('&lt;Button-WinExp&gt;', startwinexpEvent)
  startwinExp.pack()
  
  window.mainloop()
  </code></pre>