我有一个tkinter
1CheckButton
和 2的应用程序ComboBoxes
。但是,CheckButton
似乎与 the 开始的行不同,ComboBoxes
反之亦然。我已经把它们都放进去了,column=1
但即使这样似乎也不能解决它。
这是它的样子:
这是我的代码:
from tkinter import *
from tkinter import ttk
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
w = ttk.Combobox(window, values=owner)
w.current(0)
w.grid(row=1, column=1)
w0 = ttk.Combobox(window, values=vehicleid)
w0.current(0)
w0.grid(row=0, column=1)
for i,x in enumerate(equipment):
dd_equipment = Checkbutton(window, text=x, variable=x)
dd_equipment.grid(row=2+i, column=1, sticky=W)
if i == 0 or i == 1:
dd_equipment.toggle()
##The run button
run_list_button =ttk.Button(window, text="Send data of ID's to database!")
run_list_button.grid(column=0, row=5)
##These are the titles
l1 = ttk.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()