I am writing a Python application that uses tkinter, and I am trying to give a look more like new W10 applications.
With tkinter, I can apply an image as a frame background or a solid colour using bg
, or even make the frame, or the whole window transparent with alpha
.
To make the UI look better I have removed the border of the buttons with this parameters borderwidth=0,highlightthickness = 0, bd = 0
.
But I haven't find anything to make a blurry transparent frame background. Same as aero or new W10 applications.
With alpha
I can change the opacity, but not the blur.
Is there any way to make my application look like I described?

- 119,623
- 25
- 170
- 301

- 946
- 2
- 18
- 39
-
You could make the image blurry before adding it to the frame perhaps. – Nae Oct 25 '17 at 14:01
-
2@Nae What I want is a blurry transparent background, similar to aero effect. Not a static blurred background. – David González Blazman Oct 25 '17 at 14:02
-
2Possible duplicate of [Tkinter : Create blur transparency](https://stackoverflow.com/questions/38393643/tkinter-create-blur-transparency) – j_4321 Oct 25 '17 at 14:32
-
Unfortunately this feature is not offered in Tkinter. (As far as I know) – Mike - SMT Oct 25 '17 at 15:07
-
I'd try to tweak with transparent and glassy images tbh. – Nae Oct 25 '17 at 15:25
-
@j_4321 I don't think the answer to the post you mentioned could resolve my problem. Making a screenshot of the app and apply gaussian fliter to blur the image doesn't make a dynamic blur transparency like aero, or fluent design UI. – David González Blazman Oct 26 '17 at 06:23
-
I know, but the part of the answer that seemed relevant to me is that tkinter does not provide a way to get a blur effect. So only a static blurred background seems possible. If you really want a blurry transparent background, I think it would be easier to use another GUI toolkit. – j_4321 Oct 26 '17 at 07:23
-
@j_4321 So, if there isn't a way to make this with tkinter, is there a way to make it with another GUI toolkit, or mix the "other" with tkinter? Thanks – David González Blazman Oct 27 '17 at 10:43
-
2I don't know well enough any other GUI tool to show you how to do it and I don't use Windows. But I think this should be possible with Qt (https://stackoverflow.com/questions/19383427/blur-effect-over-a-qwidget-in-qt this is c++, but there must be a way to do the same with PyQt) and I advise you not to mix several GUI toolkits. – j_4321 Oct 27 '17 at 11:32
-
Thanks, I will take a look at it! – David González Blazman Nov 03 '17 at 14:29
3 Answers
Unfortunately, this service was a matter of argument in tkinter and it's not provided by it. However, you can visit here to know how to use gaussian blur method in your app.

- 5
- 3

- 21
- 2
Well, that's quite not possible in tkinter
but wait I am not saying impossible.
You just need to do the following-
NOTE: This works only if you use your app in a full-screen window without borders.
Let us see how- I'm gonna use KIVY
so please download it.
If you have
kivy
skip thiskivy
installation guide:
REMEMBER : Kivy is supported only in python 2.7, 3.7 and 3.4 so uninstall the python you have if any version does not match. To know current python version type 'python version' in cmd.
step 1). Type 'pip install kivy' in cmd
step 2). There might be an issue during the installation so as I said unistall unsupported python version.
1). Following packages are required so please download them if you don't have any of them.
- PIL
pip install PIL
- pyautogui
pip install pyautogui
2). Explanation: In Python, it is a bit difficult to use
DWM
(Desktop Window Manager) API that helps to blur the window behind. However,
in C++ there is a built-in function called EnableBlurBehind()
to blur the window behind using DWM API.
- First, we are going to take a screenshot using
pyautogui
package - Then blur the image (screenshot or background)
- Finally, set the image in canvas.
Voila! You have blurred the window behind. So let us get the concept working.
Copy this and paste into IDE only if you have downloaded the required library
- Main python file, save as name.py
# first take the screenshot else problem will occur
import pyautogui
# take screenshot
screenshot = pyautogui.screenshot()
screenshot.save('screenshot.png')
# import other required libraries
from PIL import Image, ImageFilter
from kivy.app import App
from kivy.core.window import Window
from kivy.uix.widget import Widget
from PIL import Image, ImageFilter
from win32api import GetSystemMetrics
from kivy.animation import Animation
# set window size
Window.borderless = True
Window.size = GetSystemMetrics(0), GetSystemMetrics(1)
Window.left = 0
Window.top = 0
class Blur(Widget):
# Transparent Blur Window Exmple the screenshot
get_image = Image.open('screenshot.png')
blur_image = get_image.filter(ImageFilter.GaussianBlur(radius=15))
blur_image.save('blured.png')
def anim(self):
animator = Animation(x=1800, y=500)
animator.start(self.ids.animate)
class Build(App):
def build(self):
return Blur()
Build().run()
KV Language file
save asbuild.kv
else it won't work
<Blur>:
canvas.before:
Rectangle:
pos: self.pos
size: self.size
source: 'blured.png'
Button:
id: animate
text: 'Here, you can add anything you want now. Click me!'
bold: True
italic: True
pos: 700, 500
font_size: 25
size: 400, 300
background_color: 0,0,0,0
on_press: root.anim()
If you don't know how to open file.kv
in your IDE search it. Fix any unconventional issues that you have.

- 4,271
- 8
- 34
- 56

- 51
- 3
You cannot really do it, but you can surely fake it, as demonstrated by @PyGuy. My short code however is plain Tkinter, and pyautogui, that can be helpful, in case you are not familiar with kivy, like me.
import ctypes
import pyautogui
from tkinter import *
from PIL import ImageTk, ImageFilter, ImageEnhance
import tkinter as tk
ctypes.windll.shcore.SetProcessDpiAwareness(1)
root =tk.Tk()
root.geometry("1500x1200")
frame=Frame(root)
x = 3
y = 37
ss = pyautogui.screenshot(region=(x, y, 1950, 1200))
blurImage = ss.filter(ImageFilter.GaussianBlur(radius = 20))
filter=ImageEnhance.Brightness(blurImage)
brightImage=filter.enhance(0.8)
brightImage = brightImage.filter(ImageFilter.SMOOTH_MORE())
ss = ImageTk.PhotoImage(brightImage)
root.state('zoomed')
image1 = Label(frame, image=ss)
image1.image = ss
image1.place(x=0, y=0)
frame.config(bg="white")
frame.pack(expand="true", fill=BOTH)
root.state('zoomed')
root.mainloop()

- 1
- 1