Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to make a radio in python

# Importing Tkinter module
from tkinter import *
# from tkinter.ttk import *
 
# Creating master Tkinter window
master = Tk()
master.geometry("175x175")
 
# Tkinter string variable
# able to store any string value
v = StringVar(master, "1")
 
# Dictionary to create multiple buttons
values = {"RadioButton 1" : "1",
          "RadioButton 2" : "2",
          "RadioButton 3" : "3",
          "RadioButton 4" : "4",
          "RadioButton 5" : "5"}
 
# Loop is used to create multiple Radiobuttons
# rather than creating each button separately
for (text, value) in values.items():
    Radiobutton(master, text = text, variable = v,
                value = value, indicator = 0,
                background = "light blue").pack(fill = X, ipady = 5)
 
# Infinite loop can be terminated by
# keyboard or mouse interrupt
# or by any predefined function (destroy())
mainloop()
Comment

PREVIOUS NEXT
Code Example
Python :: jupyter notebook not showing all columns 
Python :: python flask mail 
Python :: python testing machine learning 
Python :: pathlib current directory 
Python :: how to add value to to interger in python 
Python :: python tkinter askopenfile 
Python :: python datetime from string 
Python :: pandas iterate over a series 
Python :: list to dict python 
Python :: dataframe rename column 
Python :: how to copy text file items to another text file python 
Python :: python live video streaming flask 
Python :: fibonacci sequence python 
Python :: initialize an array in python 
Python :: pandas list to df 
Python :: pd get non-numeric columns 
Python :: pthon - progressbar 
Python :: minimum-number-of-steps-to-reduce-number-to-1 
Python :: sorting by second element 
Python :: df drop index 
Python :: how to remove arrays in python from a specific place 
Python :: how to shutdown a windows 10 computer using python 
Python :: sqlite3 python parameterized query 
Python :: pipilika search engine 
Python :: create empty pandas dataframe 
Python :: start virtualenv 
Python :: remove particular row number in pandas 
Python :: minimum of two columns in pandas 
Python :: print ocaml 
Python :: Python Tkinter timer animation 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =