我无法控制标签的文本。我正在使用位置来定位这些标签
下面是我的示例代码
from tkinter import *
root = Tk()
root.geometry('1080x640+0+0')
Headings = ['Months','Days','* Occupancy','Energy \nConsumption','Fuel \nConsumption', 'Specific Fuel \nConsumption','Diesel Price','Specific Energy \nConsumption']
Units = ['2017','per month','man days/month','kWh/month','Litres','Litres/kWh','AED','kWh/man/day']
Headings_wd = [0,0,0,0,0,0,0,0]
Units_wd = [0,0,0,0,0,0,0,0]
for a in range(0,len(Headings)):
Headings_wd[a] = Label(root, text = Headings[a], justify = LEFT )
Headings_wd[a].place(x = 20 + a * 100, y = 20)
Units_wd[a] = Label(root, text = Units[a], anchor = 'e' , font = ("Helvetica" , 6) )
Units_wd[a].place(x = 20 + a * 100, y = 60)
root.mainloop()
我想在标签的最右边有labels
的Units_wd
我该怎么办。你知道吗
我曾经尝试过在这个站点上使用命令Units_wd[a].config(borderwidth=1, relief="solid")
进行调试,但是当我使用place
时,这些命令不起作用。你知道吗
如注释中所述,通过使用
width
命令来获得所需的结果,可以解决问题谢谢@什么意思
相关问题 更多 >
编程相关推荐