Radio Button Menu : RadioButton « GUI Tk « Python






Radio Button Menu

Radio Button Menu
from Tkinter import *

class TestMenu:
    def __init__(self, master):
  self.master = master
  self.menubar = Menu(self.master)

        self.radmenu = Menu(self.menubar)
        self.radmenu.add_radiobutton(label='A')
        self.radmenu.add_radiobutton(label='B')
        self.radmenu.add_radiobutton(label='C')
        self.radmenu.add_radiobutton(label='D')
        self.radmenu.add_radiobutton(label='E')
        self.radmenu.add_radiobutton(label='F')
        self.radmenu.add_radiobutton(label='G')
        self.radmenu.add_radiobutton(label='H')
        self.radmenu.add_radiobutton(label='I')

        self.menubar.add_cascade(label="Radiobutton Menu", menu=self.radmenu)

  self.top = Toplevel(menu=self.menubar, width=500, relief=RAISED,
                            borderwidth=2)

def main():
    root = Tk()
    root.withdraw()
    app = TestMenu(root)
    root.mainloop()

if __name__ == '__main__':
    main()


           
       








Related examples in the same category

1.Radio Button DemoRadio Button Demo
2.Toogle group Radio ButtonToogle group Radio Button
3.Radio button in a groupRadio button in a group
4.Radio button bar: get selected button for a group radio buttonRadio button bar: get selected button for a group radio button
5.Get Radio button stateGet Radio button state
6.Hold on to your radio variables Hold on to your radio variables
7.Save Radio button statesSave Radio button states
8.What happens when some buttons have same valueWhat happens when some buttons have same value