Permalink
Cannot retrieve contributors at this time
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?
5001CEM/Machine_Status
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
44 lines (33 sloc)
1.08 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |