我试图根据我的设备中的物品CheckButton
创建一个。已创建,但并非其中的所有项目都在应用程序中可见。是不是因为我的物品太大了?tkinter
list
CheckButton
equipment
这是我的代码:
from tkinter import *
owner = ['Spain', 'United Kingdom', 'Malaysia']
vehicleid = ['C161', 'C162']
equipment = ['X-tron senistra beamer mode version 5.4433',
'Loadcell compact designer 2000 version 32.44',
'Streamcell highspeed collision extra large version 8.5']
window = Tk()
window.title("Running Python Script") # Create window
window.geometry('550x300') # Geo of the window
##These are the option menus
dd_owner = StringVar(window)
dd_owner.set(owner[0]) # the first value
w = OptionMenu(window, dd_owner, *owner)
w.grid(row=1, column=1)
dd_id = StringVar(window)
dd_id.set(vehicleid[0])
w0 = OptionMenu(window, dd_id, *vehicleid)
w0.grid(row=0, column=1)
#This is the CheckButton
dd_equipment = Checkbutton
for x in equipment:
dd_equipment = Checkbutton(window, text=x, variable=x)
dd_equipment.grid(row=2, column=1)
##The run button
run_list_button =Button(window, text="Send data of ID's to database!")
run_list_button.grid(column=0, row=3)
##These are the titles
l1 = Label(window, text='Select Owner', width=15)
l1.grid(row=1, column=0)
l0 = Label(window, text='Select vehicle id:', width = 30)
l0.grid(row=0, column=0)
l0 = Label(window, text='Select equipment:', width = 30)
l0.grid(row=2, column=0)
mainloop()
这是 tkinter 应用程序的外观: