WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Python Tkinter Transparent Background  (Read 3003 times)

Offline Rabie

  • Sr. Member
  • ****
  • Posts: 272
Python Tkinter Transparent Background
« on: May 23, 2022, 08:18:18 AM »
Hi There,

i just wrote a simple Program that gives a transparent Window with python

Code: [Select]
from tkinter import Tk
import time
from tkinter import messagebox



root = Tk()
root.wait_visibility(root)
root.wm_attributes("-alpha", 0.6)
root.mainloop()

so with this Program i get an transparent Window on Ubuntu but not on TinyCore

is there any extension i need to install to get this to work on TinyCore 13.x/x86_64 ?

Thanx



Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14847
Re: Python Tkinter Transparent Background
« Reply #1 on: May 23, 2022, 08:34:32 AM »
Is the tk8.6 extension loaded?

Offline Rabie

  • Sr. Member
  • ****
  • Posts: 272
Re: Python Tkinter Transparent Background
« Reply #2 on: May 23, 2022, 08:38:45 AM »
Is the tk8.6 extension loaded?

yes

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11049
Re: Python Tkinter Transparent Background
« Reply #3 on: May 23, 2022, 10:33:52 AM »
Alpha transparency? That needs a compositor. Normal X does not support it.
The only barriers that can stop you are the ones you create yourself.

Offline Rabie

  • Sr. Member
  • ****
  • Posts: 272
Re: Python Tkinter Transparent Background
« Reply #4 on: May 24, 2022, 07:15:39 AM »
Alpha transparency? That needs a compositor. Normal X does not support it.

that means there is no way to do it with X with some workaround ?

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14847
Re: Python Tkinter Transparent Background
« Reply #5 on: May 24, 2022, 07:51:22 AM »
You mention that things work on ubuntu - what is it using as a window manager?

Offline Rabie

  • Sr. Member
  • ****
  • Posts: 272
Re: Python Tkinter Transparent Background
« Reply #6 on: May 24, 2022, 09:24:26 AM »
You mention that things work on ubuntu - what is it using as a window manager?

Code: [Select]
ls -l /etc/alternatives/ | grep -i window
lrwxrwxrwx 1 root root  15 Mai 17 12:26 x-window-manager -> /usr/bin/mutter
lrwxrwxrwx 1 root root  31 Mai 17 12:26 x-window-manager.1.gz -> /usr/share/man/man1/mutter.1.gz

Seems to be mutter

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14847
Re: Python Tkinter Transparent Background
« Reply #7 on: May 24, 2022, 09:30:29 AM »
I've used mutter in CorePure64 with gnome-session in both x11 and wayland modes, but never standalone - it should be possible, but I haven't tried.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11049
Re: Python Tkinter Transparent Background
« Reply #8 on: May 24, 2022, 10:46:48 AM »
that means there is no way to do it with X with some workaround ?
No, it means you need to install and run a compositor. Some WMs have a compositor built-in (like gnome or kde), some can work with an external compositor. There are several to choose from, not sure if any are packaged.
The only barriers that can stop you are the ones you create yourself.

Offline Rabie

  • Sr. Member
  • ****
  • Posts: 272
Re: Python Tkinter Transparent Background
« Reply #9 on: May 27, 2022, 01:40:07 AM »
thank you i will try that