【发布时间】:2021-06-16 08:33:54
【问题描述】:
我有一个简单的 TK 应用程序,可以在一台显示器上正常运行全屏,但现在我想运行两个全屏窗口,在 Raspberry Pi 4 上的每个显示器上各一个。这两个显示器具有不同的分辨率,并且可以单独运行,但我无法让两个全屏窗口工作,两个窗口都全屏显示在第一个显示器上。
我正在尝试使用tkinter.Tk().geometry() 来做这件事,这是要走的路还是有更简单的方法?
import tkinter
root = tkinter.Tk()
# specify resolutions of both windows
w0, h0 = 3840, 2160
w1, h1 = 1920, 1080
# set up window for display on HDMI 0
win0 = tkinter.Toplevel()
win0.geometry(f"{w0}x{h0}")
win0.attributes("-fullscreen", True)
win0.config(cursor="none") # remove cursor
win0.wm_attributes("-topmost", 1) # make sure this window is on top
# set up window for display on HDMI 1
win1 = tkinter.Toplevel()
win1.geometry(f"{w1}x{h1}")
win1.attributes("-fullscreen", True)
win1.config(cursor="none")
win1.wm_attributes("-topmost", 1)
【问题讨论】:
标签: python tkinter raspberry-pi tk raspberry-pi4