Skip to content

transparent background of window? #234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
epibirikka opened this issue Sep 29, 2022 · 1 comment
Open

transparent background of window? #234

epibirikka opened this issue Sep 29, 2022 · 1 comment
Labels

Comments

@epibirikka
Copy link

I'm trying to port this code into Python, but whenever I run mine, it gives me a BadMatch later BadWindow and BadDrawable
https://stackoverflow.com/questions/13395179/empty-or-transparent-window-with-xlib-showing-border-lines-only

xlib.py (a test file):

display = Display()
screen = display.screen()
root = screen.root

class VisualInfo:
    depth = 0
    data = {}

def main():
    # XMatchVisualInfo equivalent?
    visual_info = None

    for depth_item in screen.allowed_depths:
        if depth_item.depth != 32:
            continue

        visual_info = VisualInfo()
        visual_info.depth = depth_item.depth
        visual_info.data = depth_item.visuals[0]
        break

    if visual_info is None: raise SystemExit

    main_window = root.create_window(0, 0, 500, 500, 0, visual_info.depth, X.InputOutput,
             visual=visual_info.data.visual_id, event_mask=X.StructureNotifyMask|X.KeyPressMask|X.ExposureMask)
    
    main_window.change_attributes(border_pixel=0, background_pixel=0x50ffffff)

execution:
image

meanwhile of the same code in c:
image

The error doesn't occur when I remove the visual argument and change the depth argument to 24 instead of 32, but it only displays a solid color with no transparency.

Doing this for trying to create a transparent PyGame window in Linux.

@vasily-v-ryabov
Copy link
Collaborator

This is interesting case, but I don't have Linux machine in my hands right now. The project is rarely maintained by me only. I'm mostly doing reviews and posting update releases ~2 times a year. 0.32 is just posted, but I don't think it will help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants