简体   繁体   English

Tkinter小部件

[英]Tkinter widgets

Directory: C:\Users\User\Documents
20.jpg       77fg45174161873c84172b66ba4

I would like to place the results above within the canvas widget where I have placed the text "MD5 File Hashes" , the following is being placed within the centerLabel panel. 我想将结果放在画布小部件中的上方,在其中放置了文本“ MD5 File Hashes”的地方 ,以下内容被放置在centerLabel面板中。 However, it needs to be placed within the canvas. 但是,需要将其放置在画布中。

The following code is fully functioning, but not displaying it with the results intended: 以下代码可以正常运行,但不会显示预期结果:

Label['text'] = output
canvas.itemconfig(canvas_id, text="Hashes")

Replace: 更换:

canvas.itemconfig(canvas_id, text="MD5 File Hashes")

with: 有:

canvas.itemconfig(canvas_id, text=output)

if you want to display rootDir as well you can instead replace with: 如果还要显示rootDir ,则可以替换为:

canvas.itemconfig(canvas_id, text="Directory: {}\n{}".format(rootDir, output))

The output you have is a string: 您的output是一个字符串:

>>>type(output)
<class 'str'>

So you can easily put it on as any place that accepts strings, such as print(output) and canvas.itemconfig(canvas_id, text=output) . 因此,您可以轻松地将其放在可以接受字符串的任何位置,例如print(output)canvas.itemconfig(canvas_id, text=output)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM