如何在 tkinter 上显示非零的初始值?

How to show initial value other than zero on tkinter?

执行代码时,两个框的默认值都显示为 0.0。我想分别将其更改为 50 和 60 或任何其他数字。如何才能做到这一点?

import tkinter as tk
import tkinter.ttk as ttk

window = tk.Tk()

ws = window.winfo_screenwidth()
hs = window.winfo_screenheight()
w = 700 # width for the Tk root
h = 585  # height for the Tk root
x = (ws / 2) - (w / 2)
y = (hs / 2) - (h / 2)

window.geometry('%dx%d+%d+%d' % (w, h, x, y))   

canvas = tk.Canvas(window,bg="white",width=700, height=585, highlightthickness=0)
canvas.pack()


l2 = tk.Label(canvas, text="Circumference of Tank", font="Calibri 12", bg="white")
canvas.create_window(15,78, window=l2, anchor=tk.NW)


PL1 = tk.DoubleVar()
entry_PL1 = ttk.Entry(canvas, textvariable=PL1)
entry_PL1.config({"background": "gainsboro"})
canvas.create_window(250,90, window=entry_PL1)


l3 = tk.Label(canvas, text="Height of Tank", font="Calibri 12", bg="white")
canvas.create_window(370,78, window=l3, anchor=tk.NW)

PH1 = tk.DoubleVar()
entry_PH1 = ttk.Entry(canvas, textvariable=PH1)
entry_PH1.config({"background": "gainsboro"})
canvas.create_window(610,90, window=entry_PH1)


window.mainloop()

你可以像这样给他们起个名字:

PL1.set(50)
PH1.set(60)

并且,在 window.mainloop()

之前添加它们