Two fullscreen tkinter windows on separate monitors on Raspbery Pi 4
You have to offset the second window to the right by the width of the first display (The X system puts the display on the HDMI0
port down first, then puts the display from HDMI1
to the right).geometry
lets you make sure they don't overlap and then fullscreen
works as expected.
The format of the geometry
string is: <width>x<height>+xoffset+yoffset
.
root = tkinter.Tk()# specify resolutions of both windowsw0, h0 = 3840, 2160w1, h1 = 1920, 1080# set up window for display on HDMI 0 win0 = tkinter.Toplevel()win0.geometry(f"{w0}x{h0}+0+0")win0.attributes("-fullscreen", True)# set up window for display on HDMI 1 win1 = tkinter.Toplevel()win1.geometry(f"{w1}x{h1}+{w0}+0") # <- the key is shifting right by w0 here win1.attributes("-fullscreen", True)root.withdraw() # hide the empty root window