Showing One of My Open Windows as Full Screen

I have 4 windows, a header, a footer, a sidebar for navigation, and a main window with a plot. From time to time users want need to watch the plot from afar as they make adjustments to a DUT to troubleshoot a problem. My goal is to make the one window with the plot full-screen and leave the other windows untouched and to have a button that can move back and forth between full-screen and the way the windows were before.


I have the following hacky code working to solve this problem. It shows an expand icon in a button on the plot when the window opens initially or after updates (updates also exit full-screen mode automatically so this luckily works pretty well). When the user clicks the button, I make the plot window full-screen and change to a shrink icon on the button.

This solution works currently, but it is hacky…
I set the window to always on top and use that as a check to see if I am currently in full-screen and need to shrink instead of expand the window to full-screen. When an update comes in the windows snap back to their normal positions though and sometimes I have to hit the button twice after this to go to full-screen.

`from javax.swing import JFrame, SwingUtilities

The purpose of this script is to enable full-screen for the PIM plot window,
to make data visually easier from afar.

def show_window_full_screen(win_name = 'testing/pim_swept'):
	internal_frame = system.gui.getWindow(win_name)	
	win = SwingUtilities.getWindowAncestor(internal_frame)
def exit_full_screen(win_name = 'testing/pim_swept'):
	internal_frame = system.gui.getWindow(win_name)
	win = SwingUtilities.getWindowAncestor(internal_frame)

win_name = 'testing/pim_swept'

internal_frame = system.gui.getWindow(win_name)
win = SwingUtilities.getWindowAncestor(internal_frame)

if not win.isAlwaysOnTop():
	event.source.path = 'shrink.png'
	event.source.path = 'expand.png'





Does anyone have a less hacky solution to this problem?


Trying to go completely full-screen (without the header bar and hiding the taskbar on the computer) creates too many problems. I have resolved to just use the following functions to achieve my goal.

I had to add a timer just to update the icon on the button in case an update came in when one of the internal frames is maximized, because everything snaps back to their original positions but the icon is stuck on the shrink icon. The timer script fixed this by checking if my plot window is visually intersecting another window I know will always be present.

component scripts on the full-screen button to enter/exit full-screen for the plot.

def enter_full_screen(winname):

    from javax.swing import SwingUtilities, JFrame
	internal_frame = system.gui.getWindow(winname)	
	win = SwingUtilities.getWindowAncestor(internal_frame)

def exit_full_screen(winname):

	from javax.swing import SwingUtilities
	win = SwingUtilities.getWindowAncestor(system.gui.getWindow(winname))

The timer script to reset the icon by checking if the other window is getting covered up…

win_name = 'testing/test_window'
c1 = system.gui.getWindow(win_name)
c2 = system.gui.getWindow('testing/sugar')
is_covering_other_window = c1.getBounds().intersects(c2.getBounds())
if is_covering_other_window:
	event.source.parent.getComponent('expand_compress_btn').path = 'shrink.png'
	event.source.parent.getComponent('expand_compress_btn').path = 'expand.png'

Again, hacky solution…but no one seems to have a better one. If you do, please reply!

Why do the other windows need to be untouched when in full screen?

I am not sure what you mean…

I just want to expand one window and show it above all others.
I played with code at some point that created a new JFrame and plopped the plot window into that and then expanded it, but I don’t want the user seeing another icon in the taskbar.

I am pretty much trying to accomplish the equivalent of what Netflix does when their player goes full-screen…if that makes any sense.

You can close the top / left / bottom windows when full screen. Then reopen them when getting out of full screen. The main screen will resize on its own.

if event.propertyName == "IsFullScreen":
	if event.newValue:
1 Like

Yes, but my plan is to have data in those windows as well as client properties and threads running in the background. Closing the windows is not an option, because I need all of this to remain as is and be available to the maximized/full-screen window.

Would this solution work for you?

I haven’t tried this, but this post further up in the same thread may be more what you want–directly setting the size on the windows:

That might work, but when i want to shrink the window back again I will need to keep track of its original location and size. This would require that I add custom properties to the window, but that seems clunky.

Would storing maximized state in a client tag resolve this?

I meant that as a good thing. It is fine with me, because when that update comes it causes the button icon to reset anyway.

Again, I don’t want to create a tag or store info just to maximize/minimize one of the windows. That feels hacky and wrong and doesn’t scale well when I want to do this for other windows and tools.