root.attributes('-fullscreen', True)
の代わりにroot.state(‘zoomed’)
を試してみるとどうなりますか?
Like!
ノートPCに外部ディスプレイを接続し2画面で使用しています。
OS Windows 11
Python 3.10.6
tkinterで全画面表示を行いたいのですが、サブディスプレイでのフルスクリーン表示ができなく困っています。
フルスクリーン表示は下記で実行しております。
root.attributes('-fullscreen', True)
サブディスプレイにtkinterのwindowを置いた状態でフルスクリーンにしても
メインディスプレイに表示されてしまう。
import tkinter as tk
import tkinter.ttk as ttk
def full_scrn():
root.attributes('-fullscreen', True)
root = tk.Tk()
root.geometry('200x100')
frame = ttk.Frame(root)
frame.pack(fill = tk.BOTH, padx=20,pady=10)
text = tk.StringVar(frame)
text.set('full screen')
button = tk.Button(frame, textvariable=text, command=full_scrn)
button.pack()
root.mainloop()
windowをサブディスプレイに移動させ[full screen]ボタンを押す。
→ メインディスプレイでフルスクリーン表示されてしまう。
root.attributes('-fullscreen', True)
の代わりにroot.state(‘zoomed’)
を試してみるとどうなりますか?
@pureten2
Questioner