drawing transparent and click through text on top of all windows - python

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.

Related

Making a game overlay in python

So I am trying to make a python script that when I do a certain hotkey combination, It shows a text box as an overlay like what "Geforce Experience" and "Windows Gamebar" do.
the problem is that in the game when I interact with the text-area loses focus and goes minimized as opposed to the 2 programs I spoke about before, for example windows game bar allows you interact with a lot of options while the game is still on foreground and you close the bar you are left with whatever you were with before...
I'm using tkinter for now, and if there are solution not including tkinter it is Ok as long as it achives the goal.
As far as I understand what you are trying to do is create a overlay for a game and the overlay should be created using tkinter object. Here is a library that can do that, however as far as I remember you needed to change something in it's python file, however this might have already been fixed.

How to take a screenshot of a Wxpython GUI program when menu drops down on menubar

Is it possible to capture a screenshot of a wxpython GUI program when the program menu on the menu bar drops down?. I attempted to do this by pressing the print screen key on my keyboard but it didn't work.
Nevertheless, the print screen function key works fine when the menu on the menubar does NOT drop down.
I noticed I can take screenshots of other GUI programs on my system when their menu options are seen .
If this is possible, what codes can I place in my program to facilitate a successful screenshot when any menu is showing?
I just tried "Shift-prt scr" on my Windows 8.1 to capture a screen with a menu shown (used the wxPython demo) and it worked for me.
You can also use a screen capture utility, e.g. I often use IrfanView, to do this, with it I set a timer to capture things which go away when the window looses focus.
With Ubuntu using Mate under Applications--> Accessories there is a Take Screen shot option.
The actual command is mate-screenshot --interactive
this allows you Full screen, Current window or Selected area, with a "Grab delay", I found it particularly useful documenting wxpython, although you will have to drag the window to a size to accommodate the full menu or you end up with it cut off.
Note: gnome-screenshot --interactive, is another alternative.
Edit:
Have you checked out pyscreenshot?
https://pypi.python.org/pypi/pyscreenshot
It claims the following usage:
Example:
import pyscreenshot as ImageGrab
# fullscreen
im=ImageGrab.grab()
im.show()
# part of the screen
im=ImageGrab.grab(bbox=(10,10,510,510)) # X1,Y1,X2,Y2
im.show()

Transparent Window Background (Python Tkinter)

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

How do I get a windows border like this in Tkinter?

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++

Python Game using pyGame with Window Menu elements

Here's the deal. I'm trying to write an arkanoid clone game and the thing is that I need a window menu like you get in pyGTK. For example File->(Open/Save/Exit) .. something like that and opening an "about" context where the author should be written.
I'm already using pyGame for writting the game logic. I've tried pgu to write the GUI but that doesn't help me, altough it has those menu elements I'm taking about, you can't include the screen of the game in it's container.
Does anybody know how to include such window menus with the usage of pyGame ?
wxPython allows you to integrate a Pygame window inside of a "normal" wxPython window - check out their wiki entry for how to do it. This should allow you to have a normal window (with File/Help/etc.) menus, but have a Pygame surface to which you can draw for your game.

Categories

Resources