Answer To: SPECIFICATION Create a GUI app that displays the temperature differential from the baseline Celcius...
Sathishkumar answered on Oct 11 2021
full-py/backend.py
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 13 10:44:44 2021
@author: Sathish
"""
import sqlite3
global year,median,upper,lower
year=[]
median=[]
upper=[]
lower=[]
conn = sqlite3.connect('temperature6.db')
print("Opened database successfully")
cursor = conn.execute("SELECT YEAR,MEDIAN,UPPER,LOWER from TEMPDATA5")
for row in cursor:
year.append(row[0])
median.append(row[1])
upper.append(row[2])
lower.append(row[3])
print("YEAR = ", row[0])
print("MEDIAN = ", row[1])
print("UPPER = ", row[2])
print("LOWER = ", row[3], "\n")
print("Operation done successfully")
conn.close()
class __ret__():
def __init__(self):
self.year=year
self.median=median
self.upper=upper
self.lower=lower
def getdata(self):
return self.year,self.median,self.upper,self.lower
full-py/database.py
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 11 14:46:42 2021
@author: Sathish
"""
import sqlite3
conn = sqlite3.connect('temperature6.db')
print("Opened database successfully")
conn.execute('''CREATE TABLE TEMPDATA5
(YEAR INT PRIMARY KEY NOT NULL,
MEDIAN FLOAT NOT NULL,
UPPER FLOAT NOT NULL,
LOWER FLOAT);''')
print("Table created successfully")
conn.close()
y=[]
m=[]
u=[]
lo=[]
l1=[]
with open('temperature.txt') as f:
lines=f.readlines()
for i in range(1,len(lines)):
l1=lines[i].split()
y.append(int(l1[0]))
m.append(float(l1[1]))
u.append(float(l1[2]))
lo.append(float(l1[3]))
print(y[1])
import sqlite3
print("Opened database successfully")
for i in range(len(lines)-1):
conn = sqlite3.connect('temperature6.db')
yy=y[i]
mm=m[i]
uu=u[i]
loo=lo[i]
conn.execute("INSERT INTO TEMPDATA5 (YEAR,MEDIAN,UPPER,LOWER) \
VALUES (?, ?, ?, ?)",(yy, mm, uu, loo))
conn.commit()
conn.close()
print("Records created successfully")
full-py/front.py
from tkinter import *
import numpy as np
import matplotlib.pyplot as plt
import backend
from graph import graph
from graph import graph1
from graph import graph2
global year,median,upper,lower
# Created a class object
object1 = backend.__ret__()
year,median,upper,lower=object1.getdata()
#Create an instance of Tkinter frame
win= Tk()
#Set the geometry of tkinter frame
win.geometry("100x250")
def g1():
graph(year,median,upper,lower)
def g2():
graph1(year,median,upper,lower)
def g3():
graph2(year,median,upper,lower)
#Create a button to show the plot
Button(win, text= "X-Y Plot", command= g1).pack(pady=20)
Button(win, text= "Bar Graph", command= g2).pack(pady=20)
Button(win, text= "Linear Regression", command= g3).pack(pady=20)
win.mainloop()
full-py/graph.py
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 13 10:57:25 2021
@author: Sathish
"""
import numpy as np
import matplotlib.pyplot as...