Views:
135,970β
Votes: 5β
Tags:
python
tkinter
transparency
Link:
π See Original Answer on Stack Overflow β§ π
URL:
https://stackoverflow.com/q/67994877
Title:
Transparent background in a Tkinter window
ID:
/2021/06/16/Transparent-background-in-a-Tkinter-window
Created:
June 16, 2021
Edited: November 2, 2024
Upload:
January 1, 2025
Layout: post
TOC:
false
Navigation: false
Copy to clipboard: false
The Linux Way - Install pqiv
The βLinux Wayβ seems to be installing another package:
$ sudo apt install pqiv
But as Iβve had to install xdotool
and other packages for my application whatβs another one right? Plus it will make the docker folks happy :)
The good news is it is only 136KB and automatically places the splash screen in the center of the active monitor instead of the center of the primary monitor or the center of the X11 screen (which can look funny on three monitor systems of different resolutions).
Calling pqiv
From the command line (which you can easily duplicate inside Python with os.popen()
or subprocess.Popen()
) you simply type:
pqiv -c -c -i m.png
Hereβs what it looks like with my png
image:
Closing pqiv
In the terminal I have to send Control + C when loading is finished. In Python you would have to grep
the output from ps
and kill
the job. Pretty straight forward in Linux I guess but probably foreign to our Windows friends.
Credit to Super User answer.