"x"と "x1"ボタンをクリックしたときに開くウィンドウにテキストを追加します。しかし、私はそれを理解することができませんでした。Toplevelウィンドウにテキストを追加する方法
def create_window():
window = tk.Toplevel(root)
tk.Label(window, text='your text').pack(padx=30, pady=30)
そして彼は投稿する前にいくつかの例を読んで言ったように:
import tkinter as tk
from tkinter import *
def create_window():
window = tk.Toplevel(root)
root = tk.Tk()
root.geometry("{0}x{1}+0+0".format(root.winfo_screenwidth(), root.winfo_screenheight()))
b = tk.Button(root, text="x", command=create_window)
b.pack(side=TOP, anchor=W, fill=BOTH, expand=YES)
b1 = tk.Button(root, text="x1", command=create_window)
b1.pack(side=TOP, anchor=W, fill=BOTH, expand=YES)
root.mainloop()
'Label'ウィジェットを使用してください。 –
ありがとうございます。私に少しの例を教えてください。 –
インターネットには、ラベルウィジェットを使用した例が何百万もあります。 –