-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbestProgrammingLanguageGui.py
More file actions
86 lines (60 loc) · 2.98 KB
/
bestProgrammingLanguageGui.py
File metadata and controls
86 lines (60 loc) · 2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/python
# best programming language GUI
import colorama, os, sys, traceback
from colorama import Fore, Style
from datetime import datetime
from tkinter import *
colorama.init()
def checkOs():
print("Started checking operating system at ", datetime.now().strftime("%m-%d-%Y %I:%M %p"))
if sys.platform == "win32":
print(Fore.GREEN + "Operating System:", end=""); sys.stdout.flush()
os.system('ver')
print(Style.RESET_ALL, end="")
operatingSystem = "Windows"
elif sys.platform == "darwin":
print(Fore.GREEN + "Operating System: ")
os.system('sw_vers')
print(Style.RESET_ALL, end="")
operatingSystem = "macOS"
elif sys.platform == "linux":
print(Fore.GREEN + "Operating System: ")
os.system('uname -r')
print(Style.RESET_ALL, end="")
operatingSystem = "Linux"
print("Finished checking operating system at ", datetime.now().strftime("%m-%d-%Y %I:%M %p"))
print("")
return operatingSystem
def bestProgrammingLanguage():
print("\nBest programming language GUI.\n")
try:
operatingSystem = checkOs()
if operatingSystem == "Windows":
input("Press any key to continue or press the \"Ctrl\" and \"C\" keys to quit: ")
elif operatingSystem == "macOS" or operatingSystem == "Linux":
input("Press any key to continue or press the \"control\" and \"C\" keys to quit: ")
print("")
root = Tk()
v = IntVar()
startDateTime = datetime.now()
print("Started best programming launch GUI at", startDateTime.strftime("%m-%d-%Y %I:%M %p"))
Label(root, root.title("Options"), text="""What is the best programming language?""", justify = LEFT, padx = 20).pack()
Radiobutton(root, text="Python", padx = 20, variable=v, value=1).pack(anchor=W)
Radiobutton(root, text="C/C++", padx = 20, variable=v, value=2).pack(anchor=W)
Radiobutton(root, text="JavaScript", padx = 20, variable=v, value=3).pack(anchor=W)
Radiobutton(root, text="C#", padx = 20, variable=v, value=4).pack(anchor=W)
Radiobutton(root, text="Java", padx = 20, variable=v, value=5).pack(anchor=W)
Radiobutton(root, text="Go", padx = 20, variable=v, value=6).pack(anchor=W)
Radiobutton(root, text="Rust", padx = 20, variable=v, value=7).pack(anchor=W)
mainloop()
print(Fore.GREEN + "Successfully ran best programming language GUI." + Style.RESET_ALL)
finishedDatetime = datetime.now()
print("Finished best programming language GUI at", finishedDatetime.strftime("%m-%d-%Y %I:%M %p"))
duration = finishedDatetime - startDateTime
print("Total execution time: {0} second(s)".format(duration.seconds))
print("")
except Exception as e:
print(Fore.RED + "Failed to run best programming language GUI.")
traceback.print_exc()
exit("" + Style.RESET_ALL)
bestProgrammingLanguage()