What I need is a tkinter window that is transparent,
but with a image displayed on this window is not.
I've seen the
w.attributes('-alpha', 0.1)
thing, but that makes the image transparent as well.
I need just the background of the window transparent,
so that an image on the window that has transparent parts,
will show the Users desktop through these parts.
Are there anyways to do this in Python?
(specs:
Python 2.7.1
Tkinter
PhotoImage
Windows7)
I would suggest another ui library
pretty much a duplicate to Is it possible to create a Tkinter Window with no frame, and no background?
I just learnt that pygame don't support window transparency but according to the last post here wxPython does if that's an option
more links:
draws under windows over desktop(you can adapt I think)
Discussion about various ways to implement
Related
I'm trying to create custom theme for ttk, for that I tried using full python and tcl but with both I have same problem, for few seconds when I open window/reopen with taskbar widgets with customs images are black. How can I avoid that or improve it?
Thanks!
I am creating a Lyrics display app in Tkinter and python for Ubuntu. It works fine in displaying lyrics in a window. but I want to create a on screen presentation of lyrics lines like it happens in MiniLyrics. So I want to draw over all windows and that should with click through and have transparent background.
what strategy I should use to achieve this task.
You cannot use tkinter to do what you want. Tkinter can only affect the windows it creates.
I am using VPython to visualize some data from a computer simulation.
I want to make a movie out of the VPython output. Therefore I tried to make screenshots from the vpython output window. I want to capture the output window in fullscreen mode. This way i don't need to crop the window frame. I tried ImageGrab.grab() (see here) and win32gui (see here), but both methods capture the desktop instead of the fullscreen window.
Methods screenshot and _get_windows_bytitle from here
windowtitle = 'sometitlename'
newscene = display(fullscreen=True,title=windowtitle)
newscene.cursor.visible=false
newscene.select()
b = box()
rate(1)
screenshot(_get_windows_bytitle(windowtitle)[0])
Same problem with ImageGrab.grab. Any suggestions?
I couldn't find any solution, so I used the workaround by cropping the window manually.
disp = display(width=1000, height=1040)
displayrect = (int(round(disp.x))+8, int(round(disp.y))+30, int(round(disp.width))-16, int(round(disp.height))-38)
ImageGrab.grab(displayrect)
I am not really happy with that, since it's quite messy to hardcode the window border width/height (I won't use the win32 module for that)
Does Tkinter or underlying Tk framework support the ability to apply the equivalent of the attributes() method to Frames vs. Windows?
Specifically: I have forms with a message area that I would like to fade away in jquery-like manner, eg. display a non-modal status message that fades away. I know I can fade a Tkinter window via window.attributes("-alpha", alpha), but I don't see an equivalent way to achieve this effect with a Frame. (I know I could place a top-level message window over my dialog, but coordinating the position and size of this window to match the layout of my dialog sounds complicated).
No, there is no way to do what you want. Tkinter only supports transparency on top-level windows.
Is there any way to get a border like this in Tkinter? Notice how it lacks the buttons on the top right. Also I don't want this program to show in the task bar.
This is in windows 7, btw.
Tk (and thus, Tkinter) has a command for removing all window manager decoration. This command in tkinter is the "wm_overrideredirect" method of toplevel windows. Pass it a parameter of True to remove the window manager decorations. You can then draw whatever borders you want, usually by packing a canvas over the entire window and drawing on the canvas.
However, when I experiment with this on my Mac, the window appears properly but won't take focus. Perhaps this is a bug in Tkinter. I don't see the same problem with identical code in Tcl.
The WS_DLGFRAME window style should give you a window without a titlebar and WS_EX_TOOLWINDOW is normally also used for a window like this so it is not visible in the taskbar (Or with a hidden parent window like control panel dialogs before Vista) You can figure out the exact window styles with a tool like Spy++ (Visual Studio) or WinSpy++