我需要格式化单选按钮的帮助

时间:2019-05-26 23:13:08

标签: python tkinter

我尝试使用列和行来设置单选按钮的格式,但似乎无法正确分隔和设置单选按钮。我希望所有内容都可以集中并均匀地分布在页面上。

这就是我现在得到的:

enter image description here

代码:

 ttk.Label(self, text='Testing', font=LARGE_FONT).grid(row=0, column=6)

        self.v = StringVar()                                                                #Stepper motor direction testing
        self.v.set("a")
        ttk.Label(self, text='Stepper Motor',font=SMALL_FONT).grid(row=3, column=1)
        Rad1 = ttk.Radiobutton(self, text="Clockwise",variable=self.v, value="a")
        Rad1.grid(row=9, column=1)

        Rad2 = ttk.Radiobutton(self, text="Counterclockwise",variable=self.v, value="b")                 
        Rad2.grid(row=20, column=1)

        button1 = ttk.Button(self, text="Test", command=self.validate_StepperMotor)
        button1.grid(row=55, column=1)

        self.vv = StringVar()                                                               #Stepper motor speed testing
        self.vv.set("c")
        ttk.Label(self, text='Stepper Motor Acceleration', font=SMALL_FONT).grid(row=3, column=4)        
        Rad3 = ttk.Radiobutton(self, text="Fast",variable=self.vv, value="c")                 
        Rad3.grid(row=9, column=4)
        Rad4 = ttk.Radiobutton(self, text="Slow",variable=self.vv, value="d")                 
        Rad4.grid(row=20, column=4)

        button2 = ttk.Button(self, text="Test", command=self.validate_StepperAcc)
        button2.grid(row=55, column=4)

        self.dc = StringVar()                                                               #DC motor direcion testing
        self.dc.set("e")
        ttk.Label(self, text='DC Motor', font=SMALL_FONT).grid(row=3, column=8)
        Rad5 = ttk.Radiobutton(self, text="Clockwise",variable=self.dc, value="e")                 
        Rad5.grid(row=9, column=8)
        Rad6 = ttk.Radiobutton(self, text="Counterclockwise",variable=self.dc, value="f")                 
        Rad6.grid(row=20, column=8)   
        button3 = ttk.Button(self, text="Test", command=self.validate_DC)
        button3.grid(row=55, column=8)


        self.dca = StringVar()                                                              #DC motor speed testing
        self.dca.set("g")
        ttk.Label(self, text='DC Motor Acceleration', font=SMALL_FONT).grid(row=3, column=12)
        Rad5 = ttk.Radiobutton(self, text="Fast",variable=self.dca, value="g")                 
        Rad5.grid(row=9, column=12)
        Rad6 = ttk.Radiobutton(self, text="Slow",variable=self.dca, value="h")                 
        Rad6.grid(row=20, column=12)   
        button4 = ttk.Button(self, text="Test", command=self.validate_DCAcc)
        button4.grid(row=55, column=12)


        button5 = ttk.Button(self, text='Return to HomePage',                               #A button to return to Homepage
                              command=lambda: controller.show_frame(PageOne))
        button5.grid(row=360, column=6)

0 个答案:

没有答案