1
がどのように私はボタンのいずれかをクリックしたときに、これはそれが新しいウィンドウが表示されますか、ウィンドウ内のすべてを削除し、質問と回答でそれを置き換えるになるだろう、新しいウィンドウを作成する:クイズPythonは
import tkinter
from tkinter import*
from tkinter import ttk
from tkinter import messagebox
def open_msg_box():
messagebox.showinfo(
"Event Triggered",
"Button Clicked"
)
root= Tk()
root.geometry("900x150+200+250")
root.configure(background = "Light blue")
frame = Frame(root)
style = ttk.Style()
style.configure("TButton",
foreground="midnight blue",
font="Times 20 bold italic",
padding=20)
style.configure("TLabel",
foreground="midnight blue",
font="Times 20 bold italic",
padding=20)
question = ttk.Label(root, text="Choose a Topic").pack(side=TOP)
theButton= ttk.Button(root, text="History",
command=open_msg_box).pack(side=LEFT)
theButton2= ttk.Button(root, text="Music",
command=open_msg_box).pack(side=RIGHT)
theButton3= ttk.Button(root, text="Computer Science",
command=open_msg_box).pack()
frame.pack()
root.mainloop()
あなたはもっと服装をしたいと思っていますし、何か質問がありましたら、私はそれらに答えることができるほど努力します – Hilea