-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSort_Fuel.py
More file actions
49 lines (45 loc) · 1.16 KB
/
Sort_Fuel.py
File metadata and controls
49 lines (45 loc) · 1.16 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
from tkinter import *
from tkinter import messagebox
tk=Tk()
tk.geometry("250x200+750+300")
def petrols():
s=""
fp=open("Fuel_Sorted.txt")
l=fp.read()
i=l.index("Petrol")
fp.seek(i+7)
for i in range(0,18):
s+=fp.readline()
messagebox.showinfo("Petrol", s)
def diesels():
s=""
fp=open("Fuel_Sorted.txt")
l=fp.read()
i=l.index("Diesel")
fp.seek(i+17)
for i in range(0,13):
s+=fp.readline()
messagebox.showinfo("Diesel", s)
def evs():
s=""
fp=open("Fuel_Sorted.txt")
l=fp.read()
i=l.index("EV")
fp.seek(i+35)
for i in range(0,4):
s+=fp.readline()
messagebox.showinfo("EV", s)
def hybrids():
s=""
fp=open("Fuel_Sorted.txt")
l=fp.read()
i=l.index("Hybrid")
fp.seek(i+43)
for i in range(0,3):
s+=fp.readline()
messagebox.showinfo("Hybrid", s)
Button(tk,text="Petrol",command=petrols).place(x=10,y=10)
Button(tk,text="Diesel",command=diesels).place(x=60,y=10)
Button(tk,text="EV",command=evs).place(x=10,y=60)
Button(tk,text="Petrol + Diesel Hybrid",command=hybrids).place(x=60,y=60)
tk.mainloop()