### インポート
import tkinter
### 色反転関数
def func():
if value1.get() == "ON" and value2.get() == "ON" and value3.get() == "ON":
label1.config(fg="lime", bg="red")
label2.config(fg="lime", bg="red")
label3.config(fg="lime", bg="red")
else:
label1.config(fg="red", bg="lime")
label2.config(fg="red", bg="lime")
label3.config(fg="red", bg="lime")
### メイン画面作成
main = tkinter.Tk()
### 画面サイズ設定
main.geometry("640x400")
### 画面色設定
main.configure(bg="lime")
### フレーム
frame = tkinter.Frame(master=main)
### ラベル表示変数
value1 = tkinter.StringVar()
value2 = tkinter.StringVar()
value3 = tkinter.StringVar()
### チェックボタン作成
checkbutton1 = tkinter.Checkbutton(master=main, text="チェックボタン1", font=("HG丸ゴシックM-PRO",24), fg="red", bg="lime", height=2, width=15, activeforeground="red", activebackground="lime", offvalue="OFF", onvalue="ON", variable=value1, command=func)
checkbutton2 = tkinter.Checkbutton(master=main, text="チェックボタン2", font=("HG丸ゴシックM-PRO",24), fg="red", bg="lime", height=2, width=15, activeforeground="red", activebackground="lime", offvalue="OFF", onvalue="ON", variable=value2, command=func)
checkbutton3 = tkinter.Checkbutton(master=main, text="チェックボタン3", font=("HG丸ゴシックM-PRO",24), fg="red", bg="lime", height=2, width=15, activeforeground="red", activebackground="lime", offvalue="OFF", onvalue="ON", variable=value3, command=func)
### チェックボタン初期化
value1.set("OFF")
value2.set("OFF")
value3.set("OFF")
### チェックボタン配置
checkbutton1.pack()
checkbutton2.pack()
checkbutton3.pack()
### ラベル作成
label1 = tkinter.Label(master=frame, textvariable=value1, font=("HG丸ゴシックM-PRO",36), fg="red", bg="lime", height=2, width=4)
label2 = tkinter.Label(master=frame, textvariable=value2, font=("HG丸ゴシックM-PRO",36), fg="red", bg="lime", height=2, width=4)
label3 = tkinter.Label(master=frame, textvariable=value3, font=("HG丸ゴシックM-PRO",36), fg="red", bg="lime", height=2, width=4)
### フレーム配置
frame.pack(pady=20, side="bottom")
### ラベル配置
label1.pack(side="left")
label2.pack(side="left")
label3.pack(side="left")
### イベントループ
main.mainloop()