1

I am wondering how to create a blur transparency effect in tkinter. I already know how to add the transparency effect to the window by using

root=Tk()
root.attributes("-alpha",0.95)

But how can you add the blur part?

chridam
  • 95,056
  • 21
  • 214
  • 219
Hung Truong
  • 289
  • 2
  • 5
  • 18

2 Answers2

2

This service is not provided by tkinter. However you can take a screenshot of your app and blur it yourself (see for instance ImageFilter.GaussianBlur or numpy.gaussian filter).

Community
  • 1
  • 1
FabienAndre
  • 4,250
  • 21
  • 38
1

You should use "BlurWindow" package and install it this way:

python -m pip install BlurWindow

from tkinter import *
from ctypes import windll

from BlurWindow.blurWindow import blur

root = Tk()
root.config(bg='green')

root.wm_attributes("-transparent", 'green')
root.geometry('500x400')

root.update()

hWnd = windll.user32.GetForegroundWindow()
blur(hWnd)



def color(hex):
    hWnd = windll.user32.GetForegroundWindow()
    blur(hWnd,hexColor=hex)
    

e = Entry(width=9)
e.insert(0,'#12121240')

e.pack()
b = Button(text='Apply',command=lambda:[color(e.get())])
b.pack()


root.mainloop()

win11

Pedro
  • 190
  • 2
  • 10