0

This is a 'nit', but it's driving me nuts. I'm trying to position three radio buttons in a Label Frame. The radio buttons all have the same padding, but the spacing between buttons 1 and 2 is about 1.5x more than between 2 and 3, using the exact same code.

I keep getting a 'Forbidden' error when trying to paste a screenshot of the issue so cannot show the actual image. Any ideas what would cause that? I am letting Tkinter place everything using grid.

    self.lf_PlotOptions = LabelFrame(self.lf_AnalysisFunctions, padx=0, pady=0, font="{Arabic Transparent} 16 {bold}", text="Plotting Options")
    self.lf_PlotOptions.grid(row=1, column=0, sticky=NW, columnspan=2)

    self.lb_PlotOptions = Label(self.lf_PlotOptions, text="Plot Duration")
    self.lb_PlotOptions.grid(row=0, column=0, padx=0, pady=10, sticky=NW)

    self.rb_OneYear = tk.Radiobutton(self.lf_PlotOptions, text="1 yr.", variable=self.v_PlotTimeFrame, value=12)
    self.rb_OneYear.grid(row=1, column=0, padx=0, pady=0, sticky=W)
    self.rb_TwoYears = tk.Radiobutton(self.lf_PlotOptions, text="2 yr.", variable=self.v_PlotTimeFrame, value=24)
    self.rb_TwoYears.grid(row=1, column=1, padx=0, pady=0, sticky=W)
    self.rb_ThreeYears = tk.Radiobutton(self.lf_PlotOptions, text="3 yr.", variable=self.v_PlotTimeFrame, value=36)
    self.rb_ThreeYears.grid(row=1, column=2, padx=0, pady=0, sticky=W)
Jim Rutter
  • 45
  • 4
  • 3
    Column 0 contains both the Label and the first Radiobutton, and will be as wide as the wider of the two - which is apparently the Label. Give the Label a `columnspan=` of 2 or 3, so that it isn't needlessly making that one column wider than otherwise required. – jasonharper Mar 13 '23 at 15:13
  • Of course! Thanks, didn't even think about the label. – Jim Rutter Mar 13 '23 at 15:34
  • Why not answer your own question? – relent95 Mar 14 '23 at 03:38
  • Can you answer it without typing in the answer (since it's explained here).. just want to see the green checkmark. Thanks. – Jim Rutter Mar 16 '23 at 14:00

1 Answers1

0

Gave the Label a columnspan= of 2 or 3, so that it isn't needlessly making that one column wider than otherwise required, per suggestion.

Jim Rutter
  • 45
  • 4