Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
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() |