Python Forum
[Tkinter] Grid the radio buttons
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Grid the radio buttons
#1
Hi,

How can I position the radio buttons with with grid command and rows and col

import tkinter as tk

root = tk.Tk()

var_1 = tk.IntVar()
var_2 = tk.IntVar()

tk.Label(root, 
        text="""Radio Buttons""",
        justify = tk.LEFT,
        padx = 20).pack()

tk.Radiobutton(root, 
               text="A",
               padx = 20, 
               variable=var_1, 
               value=1).pack(anchor=tk.W)

tk.Radiobutton(root, 
               text="B",
               padx = 20, 
               variable=var_1, 
               value=2).pack(anchor=tk.W)


tk.Radiobutton(root, 
               text="C",
               padx = 20, 
               variable=var_2, 
               value=1).pack(anchor=tk.W)

tk.Radiobutton(root, 
               text="D",
               padx = 20, 
               variable=var_1, 
               value=2).pack(anchor=tk.W)

root.mainloop()
Yoriz write Nov-23-2021, 04:46 PM:
Please post all code, output and errors (in their entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply


Messages In This Thread
Grid the radio buttons - by Joni_Engr - Nov-23-2021, 03:33 PM
RE: Grid the radio buttons - by DPaul - Nov-23-2021, 04:18 PM
RE: Grid the radio buttons - by BashBedlam - Nov-23-2021, 04:18 PM
RE: Grid the radio buttons - by deanhystad - Nov-23-2021, 04:26 PM
RE: Grid the radio buttons - by Joni_Engr - Nov-24-2021, 09:54 AM
RE: Grid the radio buttons - by menator01 - Nov-24-2021, 10:36 AM
RE: Grid the radio buttons - by menator01 - Nov-24-2021, 07:20 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] Is there a way to determine if a radio button has been selected? TWB 5 4,753 Jan-31-2023, 09:44 AM
Last Post: Vadanane
  [Tkinter] Radio Buttons Working Bassackwards gw1500se 6 2,255 Dec-07-2021, 07:13 PM
Last Post: menator01
  Radio butto to enable/disable combo box in Tkinter cybertooth 5 5,405 Oct-09-2021, 07:30 AM
Last Post: cybertooth
  problem with radio button crook79 3 3,628 Aug-12-2021, 02:30 PM
Last Post: deanhystad
  .grid buttons AnunnakiKungFu 3 1,965 Feb-08-2021, 05:56 PM
Last Post: deanhystad
  [Tkinter] I can't get information from a radio button aquerci 2 2,710 May-20-2020, 10:31 AM
Last Post: aquerci
  [Tkinter] Radio button help Muzz 5 3,626 Apr-28-2019, 07:43 AM
Last Post: Muzz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020