2

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
  • 100,957
  • 23
  • 236
  • 235
Hung Truong
  • 339
  • 2
  • 6
  • 19

2 Answers2

3

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,514
  • 25
  • 38
2

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
  • 360
  • 3
  • 13