1
votes

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?

2

2 Answers

2
votes

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).

0
votes

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()