Programmatically make app FULL SCREEN in PySimpleGUI - python-3.x

How to make PySimpleGUI app to be open in full screen, what I mean taking up the entire screen, not even leaving the task bar at the bottom of the screen?
This app will be running on Debian 8.
How to do this?

[EDIT May 2021 - This is an old answer. The method naming is different now. The coding conventions have changed. The documentation and examples on the PySimpleGUI GitHub have all been updated, bu StackOverflow of course has not. The result is that if you're copying code from StackOverflow, you're instantly behind. You're missing out. It'll run because PySimpleGUI is highly backward compatible, but it's not the recommended calls anymore]
Call window.Maximize() to make your window maximized as if you clicked on the titlebar to make it full screen. There are no parameters.
Make sure your window is fully created by adding .Finalize() to the end of your Window creation call like this:
window = sg.Window('Window Title', layout).Finalize()
window.Maximize()
If you want nothing at all showing except your application, then turn off the titlebar, set location = (0,0) and size=(width, height) of your screen. It won't hurt to turn on the keep_on_top parameter, unless you're planning on multiple windows.
Something like this (change the size to match your screen):
window = sg.Window('Window Title', layout, no_titlebar=True, location=(0,0), size=(800,600), keep_on_top=True)

We can also fix this problem by giving parameter 'resizable' to 'True'.
window = sg.Window('Window Title', layout, resizable=True)

Related

Tkinter check if window is visible

Is there a way to check if the root is visible (at least part of it is on the screen). I tried <tk.Tk>.winfo_viewable() and <tk.Tk>.ismapped() but both of them return True even if the window is fully hidden by another window. Checking if the window isn't focused wouldn't solve my problem.
I need it because I am working on improving this that uses <tk.Tk>.overrideredirect(True) to remove the title bar. The problem is that I can't Alt-Tab to the window so I want to call <tk.Tk>.overrideredirect(False) each time the window isn't (at least partially) visible.

Electron: Is it possible to set the current window to be frameless?

I would like to be able to toggle between framed and frameless window in my Electron app, without needing to construct a new window. This is because this option is a different view than what would be initially loaded, therefore it would be nice if there is a way to change the current window to be frameless.
I have found window.setFullscreen() for toggling between full screen mode. I've not been able to find anything similar for frameless window. Is there any such method or workaround that I'm not seeing?
As the docs go, you enable or disable window frame at the time of creation of browser window. After that, there are no methods you can call to enable or disable frame. However, if you really really want that option, there may be a workaround. And a workaround, is well, a workaround.
Create 2 browser windows, one over the other. The first one being transparent window(with frame and click-through) and the second one being your content window(without frame).
Implement your custom solution to keep size and position of both the windows in sync. Use ipc to share data between the windows.
Toggle the visibility of the transparent browser window to show/hide frame.
Some relevant resources:
Creating frameless window : https://electronjs.org/docs/api/frameless-window#create-a-frameless-window
Creating transparent window : https://electronjs.org/docs/api/frameless-window#transparent-window

Howto prevent a CFrameWnd from being mouse moved

I have an application that displays a CFrameWnd that is displayed on top of the main window. I need the window to be non-movable and non-resizable when the user selects a certain mode for the window.
My CFrameWnd is created with the styles WS_OVERLAPPEDWINDOW | WS_THICKFRAME | WS_POPUP
I have come across a solution using an overload of CWndOnNcHitTest to rewrite
HTLEFT,HTRIGHT,HTTOP,HTTOPLEFT,HTTOPRIGHT,HTBOTTOM,HTBOTTOMLEFT,HTBOTTOMRIGHT,HTSIZE,HTCAPTIONto HTBORDERto prevent the framework to recognize the areas responsible for sizing / moving.
This method works well for resizing in my case, but moving the window is still possible, although the hittest override works correctly (verified with traces).
Is there anything wrong in my approach, or could there be something interfering with this solution and if so, do you have any tips on where to look?
You should be able to make OnNcHitTest() work, don't return HTCAPTION.
Still, there's more than one way to move/size a window, you also have to worry about the system menu (type Alt+Space). Write a message handler for WM_MOVING and WM_SIZING and override the RECT so the window stays put.

Magnifier like feature inside popup window....how to?

I need to create a magnifier like feature in my app. Like the "loupe" effect on the iphone !
The problem is that I need to do that inside a popup window and I don't get how to make it work !
The popup window display a grid of colors that I generate and draw one by one using shapeDrawables. What I want is to display that color bigger, zoom on it when the user touch and move his finger around the popup window (color grid). The idea is to create a tracking-zooming effect on the colors so the user can see more clearly under wich color his finger is currently located.
Problems are :
I can't seem to create another popup window on top of this one, Android limitation I think ?
If I modify the current shapeDrawable, resize it, change the boundaries, It needs to re-display the popup window before it takes effect (which is not acceptable of course)
So, anyone knows of a way I could draw over that popup window ?
EDIT :
I've tried solving this issue using a Custom Toast object...But it doesn't quite do the trick. It works, but toast object appears slowly and so the touch motion is not in sync at all with the user movement over the color grid.
I'm not sure if this will help you or not, but you might be able to accomplish this by using a second Activity... this second Activity would use Android's translucent theme if you include the following attribute in your manifest:
<activity android:theme="#android:style/Theme.Translucent">
This second activity will now only contain what you place in your layout. That is... the "real" activity you're running will still be visible behind it (anywhere you don't cover it up with views in the new layout).
You also might prefer Theme.Dialog if you really want to resemble a popup.
Something to keep in mind if you take this approach is you will probably want to override onWindowFocusChanged() in the new activity, and finish() in the event of you losing focus. Additionally, you'll need to figure out how to share your data between the two activities.

Desktop effects (compiz) turned on: How to capture the image of a window WITH border/frame/title bar?

I would like to get the image of an X server Window (toplevel window, parent is the root Window) with its border/frame/title bar. I have already tried several libraries (Xlib, XRender, gdk, cairo) but none of them works. The captured image has the same geometry as the window but the frame is missing.
The problem is that the child window which should hold the frame image is InputOnly. The reason might be for this that the frame is rendered by the window decorator on the fly the same time as the Window itself.
I cannot capture the image from the RootWindow as the Window might be partially or entirely covered.
Redecorating the captured Window image could be an alternative.
Any suggestions? Thanks.
PS. When compiz is not running everything works as expected.
I use shutter for screen shots on linux, it's super easy to capture whatever portion of the screen you want. As a bonus, there are tools to add arrows or highlight sections.
http://shutter-project.org/preview/screenshots/

Resources