我在代码中的 def 中创建了一个名为“localtime2”的变量,然后有一个标签,上面写着“textvariable=localtime2”。问题是它不显示有关变量的信息。
localtime2 = time.asctime(time.localtime(time.time()))
tk.Label(roots, font=('arial', 16, 'bold'), textvariable=localtime2, bd=16, anchor="w").grid(row=2, column=0)
Run Code Online (Sandbox Code Playgroud)
这就是我在有关此变量的代码中的全部内容,并且在终端中没有出现任何错误。它根本不显示。