如何使用网格方法在 Tkinter 中对齐单选按钮?

How do I align Radio Buttons in Tkinter Using Grid Method?

我在使用网格方法对齐单选按钮时遇到问题,我已经尝试了粘性方法,但对齐仍然关闭 The radio buttons are not aligned

mode_of_transportation = Label(text="Mode of transportation: ", fg=PURPLE, font=(FONT, 30, "bold"),bg=BACKGROUND)
mode_of_transportation.grid(column=1,row=1, rowspan=2)
r = IntVar()
express = Radiobutton(text="Express(Grab,Uber,Taxi)",variable=r, value=0,width=20, font=(FONT, 18 , 'bold'), fg=PURPLE,bg=BACKGROUND, highlightthickness=0, activebackground=BACKGROUND )
express.grid(column=1,row=2,rowspan=2,sticky="W")

normal = Radiobutton(text="Normal(Jeep,Bus,UV,Tric)",variable=r, value=1,width=20, font=(FONT, 18 , 'bold'), fg=PURPLE,bg=BACKGROUND, highlightthickness=0, activebackground=BACKGROUND )
normal.grid(column=1,row=2,rowspan=3, sticky="W")

只需删除'width'参数

这是一个最小的例子

from tkinter import *

root = Tk()

mode_of_transportation = Label(root, text="Mode of transportation: ")
mode_of_transportation.grid(column=1, row=1)

r = IntVar()
express = Radiobutton(text="Express(Grab,Uber,Taxi)",
                      variable=r, value=0, highlightthickness=0)
express.grid(column=1, row=2, sticky="W")

normal = Radiobutton(text="Normal(Jeep,Bus,UV,Tric)",
                     variable=r, value=1,    highlightthickness=0)
normal.grid(column=1, row=3, sticky="W")

root.mainloop()

结果是: