Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
import tkinter as tk
from tkinter import ttk
root = tk.Tk()
root.title("Tab Widget")
tabControl = ttk.Notebook(root)
tab1 = ttk.Frame(tabControl)
tabControl.add(tab1, text ='Machine Status')
tabControl.pack(expand = 1, fill ="both")
ttk.Label(tab1,
text ="Welcome to Machine Status Control").grid(column = 0,
row = 0,
padx = 30,
pady = 30)
v = tk.IntVar()
v.set(1) # initializing the choice, i.e. Python
languages = [("Working", 101),
("Not Working", 102),
("Needs Supervision", 103)]
def ShowChoice():
print(v.get())
tk.Label(root,
text="""Choose the machine Status:""",
justify = tk.LEFT,
padx = 20).pack()
for language, val in languages:
tk.Radiobutton(root,
text=language,
indicatoron = 0,
padx = 20,
variable=v,
command=ShowChoice,
value=val).pack(anchor=tk.W)
root.mainloop()