我无法控制标签的文字。我正在使用地方来定位这些标签
以下是我的示例代码,
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
时它们无效。
答案 0 :(得分:2)
如评论中所述,使用<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="form-item">
<select name="select1" class="date-month">
<option value="">select</option>
<option value="1">Jan</option>
<option value="2">Feb</option>
<option value="3">Mar</option>
<option value="4">Apr</option>
<option value="5" selected="selected">May</option>
<option value="6">Jun</option>
<option value="7">Jul</option>
<option value="8">Aug</option>
</select>
</div>
<div class="form-item">
<select name="select2" class="date-month">
<option value="">select</option>
<option value="1">Jan</option>
<option value="2">Feb</option>
<option value="3">Mar</option>
<option value="4">Apr</option>
<option value="5">May</option>
<option value="6">Jun</option>
<option value="7">Jul</option>
<option value="8">Aug</option>
</select>
</div>
命令获得所需结果可解决问题
width
谢谢@WhatsThePoint