def init_guages(self): self.guages_frame = tk.Frame(self.main_window) self.guages_frame.grid(row=1, column=4) self.error_guage = tk_tools.Gauge(self.guages_frame, max_value=8, min_value=-8, red_low=20, red=80, yellow_low=30, yellow=70, label="error value", unit='') self.error_guage.set_value(0.4) self.pid_val_guage = tk_tools.Gauge(self.guages_frame, max_value=1.1, min_value=-1.1, red_low=20, red=80, yellow_low=30, yellow=70, label="pid value", unit='') self.pid_val_guage.set_value(0.1) self.error_guage.pack() self.pid_val_guage.pack()
def draw_gauge(self, max_value, label, unit): self.rs = tk_tools.Gauge(self, max_value=max_value, label=label, unit=unit, width=400, height=300, bg="#ECECEC") self.rs.grid(row=2, column=0) self.rs.set_value(0)
def initialize_gauge(self): self.gauge = tk_tools.Gauge( self.gui, max_value=100.0, # 100% label='probability', unit='%', yellow=self.gauge_yellow * 100, red=self.gauge_red * 100, ) self.gauge.pack()
def draw_gauge(self, max_value, label, unit, target_speed): target_speed_percentage = target_speed * 100 / 200 self.rs = tk_tools.Gauge(self, max_value=max_value, label=label, unit=unit, width=400, height=300, bg="#ECECEC", yellow=target_speed_percentage, red=100) self.rs.grid(row=6, column=3) self.rs.set_value(0)
def init_info_readings(self): self.depth_graph_frame = tk.Frame(self.main_window) self.depth_graph_frame.grid(row=1, column=5) self.depth_set_point = tk.Label(self.depth_graph_frame, text="setpoint value: off") self.depth_set_point.pack() graph_title = tk.Label(self.depth_graph_frame, text="Depth value:") graph_title.pack() labelfont = ('times', 20, 'bold') self.depth_value_label = tk.Label(self.depth_graph_frame, text="2.01", borderwidth=2, relief="solid", font=labelfont) self.depth_value_label.pack() self.depth_graph = tk_tools.Graph(parent=self.depth_graph_frame, x_min=0, x_max=20, y_min=0.0, y_max=4.0, x_tick=2, y_tick=0.5, width=600, height=400) self.depth_graph.pack() self.yaw_frame = tk.Frame(self.main_window) self.yaw_frame.grid(row=1, column=6) self.yaw_set_point = tk.Label(self.yaw_frame, text="setpoint value: off") self.yaw_set_point.pack() tk.Label(self.yaw_frame, text="Yaw value:").pack() self.yaw_value_label = tk.Label(self.yaw_frame, text="180", borderwidth=2, relief="solid", font=labelfont) self.yaw_value_label.pack() self.yaw_val_guage = tk_tools.Gauge(self.yaw_frame, max_value=180, min_value=-180, red_low=20, red=80, yellow_low=30, yellow=70, label="yaw val", unit='') self.yaw_val_guage.set_value(30) self.yaw_val_guage.pack()
import tkinter as tk import tk_tools root = tk.Tk() max_speed = 20000 speed_gauge = tk_tools.Gauge(root, max_value=max_speed, label='speed', unit='m/h') speed_gauge.grid(row=0, column=0, sticky='news') tach_gauge = tk_tools.Gauge(root, max_value=8000, label='tach', unit='RPM', divisions=10) tach_gauge.grid(row=1, column=0, sticky='news') strange_gauge = tk_tools.Gauge(root, max_value=30000, label='strange', unit='blah', divisions=3) strange_gauge.grid(row=2, column=0, sticky='news') count = 0 up = True def update_gauge():
img3 = ImageTk.PhotoImage(imgfile3) img3label = Label(root, image=img3) img3label.image=img2 img3label.place(x=(root.winfo_screenwidth()/2)-125,y=50) # Labels textInput="" current_temp1 = tk.StringVar() current_temp2 = tk.StringVar() current_level = tk.StringVar() current_time = tk.StringVar() phGauge = tk_tools.Gauge(root,max_value = 14, min_value = 0, label = "Ph", divisions = 14, yellow_low=42, yellow=57, red_low=35, red=64, width=300, height=200, bg="#F0F8FF") phGauge.place(x=150,y=300) phGauge.set_value(7.5) tdsGauge = tk_tools.Gauge(root,max_value = 1000, min_value = 0, label = "TDS", divisions = 20, unit="PPM", yellow=40, red=50, width=300, height=200, bg="#F0F8FF") tdsGauge.place(x=800,y=300) tdsGauge.set_value(150) def update_status(): ser.reset_input_buffer()
def __init__(self, master=None): Frame.__init__(self, master) self.grid() self.master.title("Twitter Sentiment Analyser") for r in range(6): self.master.rowconfigure(r, weight=2) for c in range(5): self.master.columnconfigure(c, weight=2) #Button(master, text="Button {0}".format(c)).grid(row=6,column=c,sticky=E+W) Frame1 = Frame(master) Frame1.grid(row = 0, column = 2, rowspan = 3, columnspan = 3, sticky = W+E+N+S, padx=(5,10), pady=(10,5)) Frame2 = Frame(master) Frame2.grid(row = 3, column = 2, rowspan = 3, columnspan = 3, sticky = W+E+N+S, padx=(5,10), pady=(5,10)) Frame3 = Frame(master,bg="lightgrey") Frame3.grid(row = 0, column = 0, rowspan = 6, columnspan = 2, sticky = W+E+N+S, padx=(10,5), pady=10) #Frame3 label1 = Label(Frame3, text="Search Tweets", bg="lightgrey",fg="black", font="arial 20 bold" ) label1.grid(row=0) label1.place(x=190,y=25, anchor="center") large_font = ('Verdana',20) key = Entry(Frame3,width="15",font=large_font) key.grid(row=1,rowspan=3) key.place(x=190,y=120, anchor="center") label2 = Label(Frame3, text="Apply Filters :", bg="lightgrey",fg="black", font="arial 15 " ) label2.grid(row=3) label2.place(x=120,y=200, anchor="center") OPTIONS = ["ALL","IN","AUS"] variable = StringVar(Frame3) variable.set(OPTIONS[0]) label3 = Label(Frame3, text="Choose a Country", bg="lightgrey",fg="black", font="arial 10" ) label3.grid(row=4) label3.place(x=150,y=270, anchor="center") w = OptionMenu(Frame3, variable, *OPTIONS) w.grid(row=4) w.place(x=250,y=270, anchor="center") photo = PhotoImage(file = r"C:\Users\sanjana\Pictures\submitbutton.jpg") #Frame 1 gauge = tk_tools.Gauge(Frame1, yellow_low=60, red_low=40, yellow=100, red=90, width=400, height=250, min_value=-1 , max_value=1, label='Polarity', bg="gray94",divisions=20,unit='%') gauge.grid(row=0) gauge.place(x=285,y=143, anchor="center") #Frame 2 table = tk_tools.LabelGrid(Frame2,num_of_columns=2, headers=["Username","Tweet"]) table.grid(row=0) table.place(x=285,y=143, anchor="center") keyresult = partial(getSentiment,key,variable,gauge,table) btn = Button(Frame3, text = 'Get Results', bd="5", width="10", command=keyresult) btn.grid(row=5) btn.place(x=190,y=400, anchor="center")
multicast_addr = '224.0.0.1' # definimos las dirección IP multicast que puede ser desde 224.0.0.0 hasta 239.255.255.255 port = 6000 # definimos el puerto por el cual se transmitirá temp1 = "" # variable para el 1er valor donde empezaran las alertas temp2 = "" # variable para 2do valor hasta donde se enviaran las alertas window = Tk() # instrucción para inicializar Tkinter window.title("::Monitor UDP::") # definimos el titulo de la ventana window.geometry('230x260') # definimos el tamaño de la ventana tk_title = Label( window, text="Temperature Monitor") # mostramos una etiqueta de tipo Label tk_title.grid(column=1, row=0) # definimos la ubicación del Label dentro de la ventana gauge = tk_tools.Gauge( window, max_value=50.0, label='Temperature', unit='°C' ) # llamamos el tool gauge y configuramos valores máximos, mínimos y el titulo gauge.grid(column=1, row=1) # definimos la ubicación del tool gauge dentro de la ventana tk_tex_intruction = Label( window, text="Rango para Alertas") # mostramos una etiqueta de tipo Label tk_tex_intruction.grid( column=1, row=3) # definimos la ubicación del Label dentro de la ventana tk_label = Label(window, text="De:") # mostramos una etiqueta de tipo Label tk_label.grid(column=1, row=4) # definimos la ubicación del Label dentro de la ventana txt_in = Entry( window, width=15
label=" Set the Angle of Base Motor", bg="white", font=('Verdana', 16), from_=0, to=180, orient=tkinter.HORIZONTAL, length=400, command=move_servo) # Speed Gauge #Create a speed-gauge using tk-tools module speed_gauge = tk_tools.Gauge(window, max_value=180, bg='white', label='Servo angle', unit=' deg', red=90, yellow=10, height=300, width=500) #Create a speed-gauge using tk-tools module speed_gauge2 = tk_tools.Gauge(window, max_value=180, bg='white', label='Servo angle', unit=' deg', red=90, yellow=10, height=300, width=500)
def tkinter_user_window(): root = Tk() root.title('Vehicle Information') var = StringVar() var2 = StringVar() max_speed = 20 global terrain speed_gauge = tk_tools.Gauge(root, max_value=max_speed, label='Speed', unit=' m/s', bg='grey') speed_gauge.grid(row=0, column=0, sticky='news') def update_gauge(): global vel # update the gauges according to their value speed_gauge.set_value(vel[1]) root.after(50, update_gauge) var.set("Gathering terrain data") def check(): if (curTerrain[0] == 1): var.set("Terrain is: Mud") root.after(50, check) elif (curTerrain[0] == 2): var.set("Terrain is: Dirt Road") root.after(50, check) elif (curTerrain[0] == 3): var.set("Terrain is: Grass") root.after(50, check) else: var.set("Gathering terrain data") root.after(50, check) var2.set("Gathering Vehicle Position data") def getPose(): var2.set("Vehicle position is (" + str(poseX[1]) + "m, " + str(poseY[1]) + "m).") root.after(50, getPose) lbl = Label(root, textvariable=var, anchor=NW, justify=CENTER, bg="grey", fg="white") lbl.grid(row=1, column=0, sticky='news') lbl = Label(root, textvariable=var2, anchor=NW, justify=CENTER, bg="grey", fg="white") lbl.grid(row=2, column=0, sticky='news') # root.after(500, getOverallVel) root.after(50, check) root.after(50, getPose) root.after(50, update_gauge) root.mainloop()
def __init__(self, parent, controller): global ecCounter, phCounter tk.Frame.__init__(self, parent) self.controller = controller leftFrame = tk.Frame(self, bg='cyan', width=100, height=100) rightFrame = tk.Frame(self, width=100, height=100) leftFrame.grid(row=0, column=0) rightFrame.grid(row=0, column=1, padx=70) btn1 = tk.Button(leftFrame, text="Status", width=15, height=7, pady=7, font=("Helvetica, 10")) btn1.grid(row=0, column=0, sticky='w') btn2 = tk.Button(leftFrame, text="Settings", command=lambda: controller.show_frame("SettingPage"), width=15, height=7, pady=7, font=("Helvetica, 10")) btn2.grid(row=1, column=0, sticky='w') btn3 = tk.Button( leftFrame, text="Recalibration", command=lambda: controller.show_frame("RecalibratePage"), width=15, height=7, pady=7, font=("Helvetica, 10")) btn3.grid(row=2, column=0, sticky='w') btn4 = tk.Button( leftFrame, text="About", command=lambda: controller.show_frame("ConnectionPage"), width=15, height=7, pady=7, font=("Helvetica, 10")) btn4.grid(row=3, column=0, sticky='w') ecTitle = tk.Label(rightFrame, text="EC Value", font=("Helvetica, 35")) ecTitle.grid(row=0, column=0) phTitle = tk.Label(rightFrame, text="pH Value", font=("Helvetica, 35")) phTitle.grid(row=0, column=1, padx=100) #ecVal = tk.Label(rightFrame, text = ecCounter, pady = 60, font = ("Helvetica, 30")) #ecVal.grid(row = 2, column = 0) #phVal = tk.Label(rightFrame, text = phCounter, pady = 60, font = ("Helvetica, 30")) #phVal.grid(row = 2, column = 1) ecGauge = tk_tools.Gauge(rightFrame, height=150, max_value=10, label='ec', unit='us/cm', divisions=10) ecGauge.grid(row=2, column=0) phGauge = tk_tools.Gauge(rightFrame, height=150, max_value=14, label='pH', unit=' ', divisions=14, red_low=20, yellow_low=35, yellow=80, red=90) phGauge.grid(row=2, column=1) def getNew(): global ecCounter, phCounter db = pymysql.connect("localhost", "root", "009564", "Status") cursor = db.cursor() sql = "SELECT ec, ph FROM ecphCurrent WHERE id=1" try: cursor.execute(sql) result = cursor.fetchone() ecCounter = result[0] phCounter = result[1] except: ecCounter = 0 phCounter = 0 #ecVal.config(text = round(ecCounter,1)) #phVal.config(text = round(phCounter,1)) ecGauge.set_value(ecCounter) phGauge.set_value(phCounter) db.close() self.after(1000, getNew) getNew()
import tkinter as tk import tk_tools import serial from tkinter import * from tk_tools.images import * max_value = 1023.0 min_value = 0.0 e = serial.Serial("COM11", 115200) root = tk.Tk() p1 = tk_tools.RotaryScale(root, max_value=max_value, size=100, unit=' ADC') p1.pack() gauge = tk_tools.Gauge(root, max_value=1023, label='ADC', unit=' ') gauge.pack() th = tk_tools.Thermo(root, max_value=max_value, size=200, thermo_color='blue') th.pack() en = Entry(root) en.pack() def readSerial(): a = e.readline() en.delete(0, 10) en.insert(1, a) a = en.get() p1.set_value(float(a)) gauge.set_value(float(a)) th.set_value(float(a))
def create_widgets(self): self.tank_pressure_label = tk.Label(self, font='TimesNewRoman 14', text="Tank pressure:") self.tank_pressure_label.grid( row=30, column=2, ) self.tank_pressure_data = tk.Text(self, wrap='word', font='TimesNewRoman 14', bg=self.cget('bg'), relief='flat', width=5, height=1) self.tank_pressure_data.grid( row=30, column=3, ) self.input_pressure_label = tk.Label(self, font='TimesNewRoman 14', text="Inlet pressure:") self.input_pressure_label.grid( row=31, column=2, ) self.input_pressure_data = tk.Text(self, wrap='word', font='TimesNewRoman 14', bg=self.cget('bg'), relief='flat', width=5, height=1) self.input_pressure_data.grid( row=31, column=3, ) self.air_pressure_label = tk.Label(self, font='TimesNewRoman 14', text="Air pressure:") self.air_pressure_label.grid( row=32, column=2, ) self.air_pressure_data = tk.Text(self, wrap='word', font='TimesNewRoman 14', bg=self.cget('bg'), relief='flat', width=5, height=1) self.air_pressure_data.grid( row=32, column=3, ) self.oxygen_pressure_label = tk.Label(self, font='TimesNewRoman 14', text="Oxygen pressure:") self.oxygen_pressure_label.grid( row=33, column=2, ) self.oxygen_pressure_data = tk.Text(self, wrap='word', font='TimesNewRoman 14', bg=self.cget('bg'), relief='flat', width=5, height=1) self.oxygen_pressure_data.grid( row=33, column=3, ) self.breathing_pressure_label = tk.Label(self, font='TimesNewRoman 14', text="Breathing pressure:") self.breathing_pressure_label.grid( row=34, column=2, ) self.breathing_pressure_data = tk.Text(self, wrap='word', font='TimesNewRoman 14', bg=self.cget('bg'), relief='flat', width=5, height=1) self.breathing_pressure_data.grid( row=34, column=3, ) self.flow_label = tk.Label(self, font='TimesNewRoman 14', text="Flow:") self.flow_label.grid( row=35, column=2, ) self.flow_data = tk.Text(self, wrap='word', font='TimesNewRoman 14', bg=self.cget('bg'), relief='flat', width=5, height=1) self.flow_data.grid( row=35, column=3, ) self.led = tk_tools.Led(self, size=50) self.led.grid( row=37, column=2, ) self.led.to_red() self.led_data = tk.Text(self, wrap='word', font='TimesNewRoman 14', bg=self.cget('bg'), relief='flat', width=20, height=1) self.led_data.grid( row=36, column=2, ) self.gauge_tank = tk_tools.Gauge(self, max_value=150.0, label='Pressure', unit='PSI', bg='white') self.gauge_tank.grid(row=31, column=4) self.tank_label = tk.Label(self, font='TimesNewRoman 14', text="Tank Pressure") self.tank_label.grid(row=32, column=4) self.gauge_air = tk_tools.Gauge(self, max_value=1024.0, label='Pressure', unit='cmH2O', bg='white') self.gauge_air.grid(row=31, column=5) self.air_label = tk.Label(self, font='TimesNewRoman 14', text="Air Pressure") self.air_label.grid(row=32, column=5) self.gauge_oxygen = tk_tools.Gauge(self, max_value=1024.0, label='Pressure', unit='cmH2O', bg='white') self.gauge_oxygen.grid(row=31, column=6) self.oxygen_label = tk.Label(self, font='TimesNewRoman 14', text="Oxygen Pressure") self.oxygen_label.grid(row=32, column=6) self.gauge_breath = tk_tools.Gauge(self, max_value=1024.0, label='Pressure', unit='cmH2O', bg='white') self.gauge_breath.grid(row=31, column=7) self.breath_label = tk.Label(self, font='TimesNewRoman 14', text="Breath Pressure") self.breath_label.grid(row=32, column=7) self.slider_volume = tk.Scale(self, from_=255, to=0, length=300, resolution=1, troughcolor='blue', fg='red', label='Volume (ml)', width=35) self.slider_volume.set(0) self.slider_volume.grid( row=35, column=4, ) self.slider_bpm = tk.Scale(self, from_=30, to=5, length=300, resolution=1, troughcolor='blue', fg='red', label='BPM', width=35) self.slider_bpm.set(12) self.slider_bpm.grid( row=35, column=5, ) self.slider_o = tk.Scale(self, from_=100, to=1, length=300, resolution=1, troughcolor='blue', fg='red', label='Oxygen (%)', width=35) self.slider_o.set(21) self.slider_o.grid( row=35, column=6, ) self.slider_ratio = tk.Scale(self, from_=3, to=1, length=300, resolution=1, troughcolor='blue', fg='red', label='I:E Ratio', width=35) self.slider_ratio.set(1) self.slider_ratio.grid( row=35, column=7, ) self.slider_alarm = tk.Scale(self, from_=50, to=10, length=300, resolution=1, troughcolor='blue', fg='red', label='Presure Alarm', width=35) self.slider_alarm.set(30) self.slider_alarm.grid( row=35, column=8, ) self.send_button = tk.Button(self, text="Start with selected parameters", command=self.send_data, height=2, width=25, fg='black') self.send_button.grid(row=37, column=6) self.t2 = threading.Thread(target=self.populate_data, name='t2') self.t2.start()
def create_widgets(self): """Create Widgets for the main window""" # parent frame overall = Frame(self.parent, relief=RIDGE, background='gray40') overall.pack(side=LEFT, fill=BOTH) leftFrame = Frame(overall, relief=FLAT, background='gray40') leftFrame.pack(side=TOP, fill=Y) self.centerFrame = Frame(self.parent, relief=RIDGE, background='gray40') self.centerFrame.pack(side=LEFT, fill=Y) rightFrame = Frame(self.parent, relief=FLAT, background='gray30') rightFrame.pack(side=TOP, fill=Y) # Mode selection Frame self.mode = LabelFrame(leftFrame, text="Mode", font=('arial', 11, 'bold')) self.mode.configure(background='gray40') self.mode.pack(anchor=W) self.mode_var = IntVar() self.manual_mode = Radiobutton(self.mode, text='Manual', value=1, variable=self.mode_var, indicatoron=0, fg='red', background='gray10', font=('verdana', 11, 'bold'), width=10, selectcolor='lawngreen').pack(side=LEFT, padx=18, pady=5) self.intelligent_mode = Radiobutton(self.mode, text='Intelligent', value=2, variable=self.mode_var, indicatoron=0, fg='red', background='gray10', font=('verdana', 11, 'bold'), width=10, selectcolor='lawngreen').pack( side=LEFT, padx=18, pady=5) self.remote_mode = Radiobutton(self.mode, text='Remote', value=3, variable=self.mode_var, indicatoron=0, fg='red', background='gray10', font=('verdana', 11, 'bold'), width=10, command=self.initialize_remote_panel, selectcolor='lawngreen').pack(side=LEFT, padx=18, pady=5) # ==============================Pick coordinates frame================================================ self.pick_group = LabelFrame(leftFrame, text="Pick Position", font=('arial', 11, 'bold')) self.pick_group.configure(background='gray40') self.pick_group.pack(anchor=W) Label( self.pick_group, font=('verdana', 11), text="Enter coordinates of the desired position of gripper center", background='gray40').pack() # picking position coordinates entry frame pick_entry_frame = Frame(self.pick_group, relief=FLAT, background='gray40') pick_entry_frame.configure(background='gray40') x_coords = Frame(pick_entry_frame, relief=FLAT, background='gray40') x_coords.pack() x_label = Label(x_coords, text='x: ', font=('verdana', 11), background='gray40') self.x = numericValidator.NumericEntry(x_coords, font=('verdana', 11, 'bold'), background='gray70', width=10) x_label.pack(side=LEFT) self.x.pack(side=LEFT) y_coords = Frame(pick_entry_frame, relief=FLAT, background='gray40') y_coords.pack() y_label = Label(y_coords, text='y: ', font=('verdana', 11), background='gray40') self.y = numericValidator.NumericEntry(y_coords, font=('verdana', 11, 'bold'), background='gray70', width=10) y_label.pack(side=LEFT) self.y.pack(side=LEFT) z_coords = Frame(pick_entry_frame, relief=FLAT, background='gray40') z_coords.pack() z_label = Label(z_coords, text='z: ', font=('verdana', 11), background='gray40') self.z = numericValidator.NumericEntry(z_coords, font=('verdana', 11, 'bold'), background='gray70', width=10) z_label.pack(side=LEFT) self.z.pack(side=LEFT) # Inverse Kinematics computing button self.pick_ik = Button(pick_entry_frame, text="Compute IK", borderwidth=1, font=('verdana', 11, 'bold'), relief=SOLID, background='gray10', fg='orange') self.pick_ik.pack(pady=5) pick_entry_frame.pack() # pick position joint angles Label(self.pick_group, font=('verdana', 11), text="Joint Angles (deg)", background='gray40').pack(pady=5) joint_angles_frame = Frame(self.pick_group, relief=FLAT, background='gray40') shoulder_az = Frame(joint_angles_frame, relief=FLAT, background='gray40') shoulder_az.pack() Label(shoulder_az, text='Shoulder Azimuth:', font=('verdana', 11), background='gray40').pack(side=LEFT) self.shoulder_azimuth = numericValidator.NumericEntry( shoulder_az, width=10, font=('verdana', 11, 'bold'), background='gray70', ) self.shoulder_azimuth.pack(side=LEFT) shoulder_pivot = Frame(joint_angles_frame, relief=FLAT, background='gray40') shoulder_pivot.pack() Label(shoulder_pivot, text='Shoulder Pivot: ', font=('verdana', 11), background='gray40').pack(side=LEFT) self.shoulder_pivot = numericValidator.NumericEntry( shoulder_pivot, width=10, font=('verdana', 11, 'bold'), background='gray70', ) self.shoulder_pivot.pack(side=LEFT) elbow_p = Frame(joint_angles_frame, relief=FLAT, background='gray40') elbow_p.pack() Label(elbow_p, text='Elbow Pivot: ', font=('verdana', 11), background='gray40').pack(side=LEFT) self.elbow_pivot = numericValidator.NumericEntry(elbow_p, width=10, font=('verdana', 11, 'bold'), background='gray70') self.elbow_pivot.pack(side=LEFT) wrist_p = Frame(joint_angles_frame, relief=FLAT, background='gray40') wrist_p.pack() Label(wrist_p, text='Wrist Pitch: ', font=('verdana', 11), background='gray40').pack(side=LEFT) self.wrist_pivot = numericValidator.NumericEntry(wrist_p, width=10, font=('verdana', 11, 'bold'), background='gray70') self.wrist_pivot.pack(side=LEFT) joint_angles_frame.pack(side=TOP) # pick_x.component('entry').focus_set() # ===================================END================================================================ # ===================================placing coordinates frame====================================== self.place_group = LabelFrame(leftFrame, text='Place Position', font=('arial', 11, 'bold'), background='gray40') self.place_group.pack(anchor=W) Label( self.place_group, font=('verdana', 11), text="Enter coordinates of the desired position of gripper center", background='gray40').pack() # picking position coordinates entry frame place_entry_frame = Frame(self.place_group, relief=FLAT) place_x_coords = Frame(place_entry_frame, relief=FLAT, background='gray40') place_x_coords.pack() place_x_label = Label(place_x_coords, text='x: ', font=('verdana', 11), background='gray40') self.place_x = numericValidator.NumericEntry(place_x_coords, font=('verdana', 11, 'bold'), background='gray70', width=10) place_x_label.pack(side=LEFT) self.place_x.pack(side=LEFT) place_y_coords = Frame(place_entry_frame, relief=FLAT, background='gray40') place_y_coords.pack() place_y_label = Label(place_y_coords, text='y: ', font=('verdana', 11), background='gray40') self.place_y = numericValidator.NumericEntry(place_y_coords, font=('verdana', 11, 'bold'), background='gray70', width=10) place_y_label.pack(side=LEFT) self.place_y.pack(side=LEFT) place_z_coords = Frame(place_entry_frame, relief=FLAT, background='gray40') place_z_coords.pack() place_z_label = Label(place_z_coords, text='z: ', font=('verdana', 11), background='gray40') self.place_z = numericValidator.NumericEntry(place_z_coords, font=('verdana', 11, 'bold'), background='gray70', width=10) place_z_label.pack(side=LEFT) self.place_z.pack(side=LEFT) # Inverse Kinematics computing button self.place_ik = Button(self.place_group, text="Compute IK", borderwidth=1, font=('verdana', 11, 'bold'), relief=SOLID, background='gray10', fg='orange') place_entry_frame.pack() self.place_ik.pack(pady=5) # pick position joint angles Label(self.place_group, font=('verdana', 11), text="Joint Angles (deg)", background='gray40').pack(pady=5) place_joint_angles = Frame(self.place_group, relief=FLAT, background='gray40') shoulder_az = Frame(place_joint_angles, relief=FLAT, background='gray40') shoulder_az.pack() Label(shoulder_az, text='Shoulder Azimuth:', font=('verdana', 11), background='gray40').pack(side=LEFT) self.shoulder_azimuth = numericValidator.NumericEntry( shoulder_az, width=10, font=('verdana', 11, 'bold'), background='gray70', ) self.shoulder_azimuth.pack(side=LEFT) shoulder_pivot = Frame(place_joint_angles, relief=FLAT, background='gray40') shoulder_pivot.pack() Label(shoulder_pivot, text='Shoulder Pivot: ', font=('verdana', 11), background='gray40').pack(side=LEFT) self.shoulder_pivot = numericValidator.NumericEntry( shoulder_pivot, width=10, font=('verdana', 11, 'bold'), background='gray70', ) self.shoulder_pivot.pack(side=LEFT) elbow_p = Frame(place_joint_angles, relief=FLAT, background='gray40') elbow_p.pack() Label(elbow_p, text='Elbow Pivot: ', font=('verdana', 11), background='gray40').pack(side=LEFT) self.elbow_pivot = numericValidator.NumericEntry( elbow_p, width=10, font=('verdana', 11, 'bold'), background='gray70', ) self.elbow_pivot.pack(side=LEFT) wrist_p = Frame(place_joint_angles, relief=FLAT, background='gray40') wrist_p.pack() Label(wrist_p, text='Wrist Pitch: ', font=('verdana', 11), background='gray40').pack(side=LEFT) self.wrist_pivot = numericValidator.NumericEntry( wrist_p, width=10, font=('verdana', 11, 'bold'), background='gray70', ) self.wrist_pivot.pack(side=LEFT) place_joint_angles.pack(side=TOP) # ===================================END==================================================================== # ===================================Operation Buttons====================================================== operations = Frame(leftFrame, relief=FLAT, background='gray40') operations.pack(side=LEFT, anchor=W, fill=Y) #===============================OPERATION BUTTONS================================================ # run button self.btnRun = Button(operations, text='RUN ', font=('lucida', 11, 'bold'), fg='red', width=10, background='gray60', command=self.run) self.btnRun.pack(padx=4, pady=10, side=LEFT) self.btnStop = Button(operations, text='STOP', font=('lucida', 11, 'bold'), fg='red', width=10, background='gray60', command=self.stop) self.btnStop.pack(padx=4, pady=10, side=LEFT) self.btnExit = Button(operations, text='EXIT', font=('lucida', 11, 'bold'), fg='red', width=10, background='gray60', command=self.exit) self.btnExit.pack(padx=4, pady=10, side=LEFT) # =================================END======================================================================== # ==================================No of objects to be picked================================================ parametersFrame = LabelFrame(self.centerFrame, background='gray40', text='Operation Parameters', font=('arial', 11, 'bold')) parametersFrame.pack(side=TOP) objects = Frame(parametersFrame, background='gray40') objectsLabel = Label(objects, text='No. of Objects: ', font=('verdana', 11), background='gray40') self.objectsEntry = numericValidator.NumericEntry(objects, background='gray70', font=('verdana', 11, 'bold'), width=20) objectsLabel.pack(side=LEFT) self.objectsEntry.pack(side=LEFT, pady=4) objects.pack(side=TOP) servoFrame = Frame(parametersFrame, background='gray40') servoLabel = Label(servoFrame, text="Servo Speed: ", font=('verdana', 11), background='gray40') # servoEntry = Entry(servoFrame, background='gray70', width=10) self.servoEntry = Pmw.Counter( servoFrame, entry_width=20, entryfield_value='12.5', datatype={ 'counter': 'real', 'separator': '.' }, entryfield_validate={ 'validator': 'real', 'min': 0.0, 'max': 15.0, 'separator': '.' }, increment=.2, ) servoLabel.pack(side=LEFT) self.servoEntry.pack(side=LEFT, fill=Y, pady=4) servoFrame.pack(side=LEFT) # ==================================END====================================================================== # status bar sbar = Frame(overall, relief=SUNKEN, background='gray40') self.statusbar = Label(sbar, text='Status:', bd=1, anchor=W, font=('consolas', 13, 'bold')) self.statusbar.configure(background='gray40', fg='lawngreen') self.cstat = Label(sbar, text='...', fg='lawngreen', background='gray40', font=('consolas', 13, 'bold')) self.statusbar.pack(anchor=W, side=LEFT) self.cstat.pack(anchor=W, side=LEFT) sbar.pack(fill=X) jaw_label = Label(self.centerFrame, text='Set Jaw width(mm)', font=('verdana', 10, 'bold'), background='gray40') jaw_label.pack(anchor=CENTER) # CREATE THE JAW WIDTH SLIDER self.slider_var = DoubleVar() self.scaler = Scale(self.centerFrame, variable=self.slider_var, orient=HORIZONTAL, from_=0, to=90, tickinterval=0.2, sliderlength=4, relief=FLAT, length=355, fg='steelblue', bg='gray40', activebackground='brown', font=('consolas', 11, 'bold')) self.scaler.pack(anchor=CENTER) # Upload parameters Button self.load_parameters = Button(self.centerFrame, text=' UPLOAD ', font=('lucida', 11, 'bold'), fg='red', width=11, background='gray60', command=self.load_to_console) self.load_parameters.pack(padx=4, pady=10, side=TOP, anchor=W) # End of upload button # ==================System info============================================== simulator = LabelFrame(self.centerFrame, text='System Information', font=('arial', 11, 'bold'), height=700) simulator.pack(side=TOP, fill=Y, anchor=W) simulator.configure(background='gray40') # environment_parameters = LabelFrame(simulator, text='<<<Loaded Parameters:>', font=('consolas', 11)) # environment_parameters.configure(background='gray40', fg='black') # environment_parameters.pack(side=TOP) tFrame = Frame(simulator, relief=FLAT) Label(tFrame, text='Modified: ', fg='black', background='gray40', font=('consolas', 11)).pack(side=LEFT) self.ctime = Label(tFrame, text='_', fg='black', background='gray40', font=('consolas', 11)) self.ctime.pack(anchor=W) tFrame.pack(anchor=W) filler = Label(simulator, text='================================', background='gray40', fg='black') filler.pack() username = Frame(simulator, relief=FLAT) Label(username, text='Current User :'******'black', background='gray40', font=('consolas', 11)).pack(side=LEFT) self.uname = Label(username, text='e5430', background='gray40', fg='black', font=('consolas', 11)) self.uname.pack(anchor=W) username.pack(anchor=W) operatinSys = Frame(simulator, relief=FLAT) Label(operatinSys, text='OS :', fg='black', background='gray40', font=('consolas', 11)).pack(side=LEFT) self.operatingsys = Label(operatinSys, text='_', background='gray40', fg='black', font=('consolas', 11)) self.operatingsys.pack(anchor=W) operatinSys.pack(anchor=W) controller = Frame(simulator, relief=FLAT) Label(controller, text='Microcontroller :', fg='black', background='gray40', font=('consolas', 11)).pack(side=LEFT) self.control = Label(controller, text='ATMEGA328P', background='gray40', fg='black', font=('consolas', 11)) self.control.pack(anchor=W) controller.pack(anchor=W) configuration = Frame(simulator, relief=FLAT) Label(configuration, text='DoF :', fg='black', background='gray40', font=('consolas', 11)).pack(side=LEFT) self.config = Label(configuration, text='6', background='gray40', fg='black', font=('consolas', 11)) self.config.pack(anchor=W) configuration.pack(anchor=W) run = Frame(simulator, relief=FLAT) Label(run, text='Run mode:', fg='black', background='gray40', font=('consolas', 11)).pack(side=LEFT) self.run_mode = Label(run, text='_', background='gray40', fg='black', font=('consolas', 11)) self.run_mode.pack(anchor=W) run.pack(anchor=W) coords = Frame(simulator, relief=FLAT) Label(coords, text='Pick coordinates : ', fg='black', background='gray40', font=('consolas', 11)).pack(side=LEFT) self.pick_coords = Label(coords, text='_', background='gray40', fg='black', font=('consolas', 11)) self.pick_coords.pack(anchor=W) coords.pack(anchor=W) pcoords = Frame(simulator, relief=FLAT) Label(pcoords, text='Place Coordinates : ', fg='black', background='gray40', font=('consolas', 11)).pack(side=LEFT) self.place_coords = Label(pcoords, text='_', background='gray40', fg='black', font=('consolas', 11)) self.place_coords.pack(anchor=W) pcoords.pack(anchor=W) speed = Frame(simulator, relief=FLAT) Label(speed, text='Servo speed : ', fg='black', background='gray40', font=('consolas', 11)).pack(side=LEFT) self.servo_speed = Label(speed, text='_', background='gray40', fg='black', font=('consolas', 11)) self.servo_speed.pack(anchor=W) speed.pack(anchor=W) objs = Frame(simulator, relief=FLAT) Label(objs, text='Objects : ', fg='black', background='gray40', font=('consolas', 11)).pack(side=LEFT) self.object = Label(objs, text='_', background='gray40', fg='black', font=('consolas', 11)) self.object.pack(anchor=W) objs.pack(anchor=W) grip = Frame(simulator, relief=FLAT) Label(grip, text='Gripper width : ', fg='black', background='gray40', font=('consolas', 11)).pack(side=LEFT) self.gripper_width = Label(grip, text='_', background='gray40', fg='black', font=('consolas', 11)) self.gripper_width.pack(anchor=W) grip.pack(anchor=W) # =====================END======================================================== # Serial port self.centerLower = Frame(self.centerFrame, background='gray40') self.centerLower.pack(side=TOP) serialFrame = Frame(self.centerLower, background='gray40') serialFrame.pack(fill=X, side=TOP) serialLabel = Label(serialFrame, text='Serial Port: ', background='gray40', font=('verdana', 11)) serialLabel.pack(side=LEFT, anchor=W, fill=X) self.ports = ['COM13', 'COM17'] self.serialport = ttk.Combobox(serialFrame, font=('courier', 11), values=['COM13', 'COM17']) self.serialport.pack(side=LEFT) self.serialport.current(0) self.connect_status = Frame(self.centerLower, background='gray40') self.connect_status.pack(side=BOTTOM) self.connectLabel = Label(self.connect_status, text='', background='gray40', font=('verdana', 10, 'bold')) self.connectLabel.pack(anchor=CENTER) # =====================ANALOG GAUGES================================================ # subdividing the right frame rightupper = LabelFrame(rightFrame, bg='gray40', text='Monitors', font=('verdana', 10, 'bold')) rightupper.pack() self.inputVoltage = tools.Gauge(rightupper, width=180, height=150, min_value=0.0, max_value=5, label='Volts-In', unit='V', bg='gray40', yellow=100, red=100, red_low=80) self.inputVoltage.set_value(4.5) self.inputVoltage.grid(row=0, column=0) self.motorOne = tools.Gauge(rightupper, width=180, height=150, min_value=0.0, max_value=5, label='M1', unit='mW', bg='gray40', red_low=70, yellow=100) self.motorOne.set_value(4) self.motorOne.grid(row=0, column=1) self.motorTwo = tools.Gauge(rightupper, width=180, height=150, min_value=0.0, max_value=5, label='M2', unit='mW', bg='gray40', red_low=70, yellow=100) self.motorTwo.set_value(4.5) self.motorTwo.grid(row=0, column=2) self.motorThree = tools.Gauge(rightupper, width=180, height=150, min_value=0.0, max_value=5, label='M3', unit='mW', bg='gray40', red_low=70, yellow=100) self.motorThree.set_value(4.5) self.motorThree.grid(row=1, column=0) self.motorFour = tools.Gauge(rightupper, width=180, height=150, min_value=0.0, max_value=5, label='M4', unit='mW', bg='gray40', red_low=70, yellow=100) self.motorFour.set_value(3) self.motorFour.grid(row=1, column=1) # self.motorFive = tools.Gauge(rightupper, width=180, height=150, min_value=0.0, max_value=5, label='M5', unit='mw', bg='gray40', red_low=70, yellow=100) self.motorFive.set_value(4.5) self.motorFive.grid(row=1, column=2) # self.gripperMotor = tools.Gauge(rightupper, width=180, height=150, min_value=0.0, max_value=5, label='Gmotor', unit='mW', bg='gray40', red_low=70, yellow=100) self.gripperMotor.set_value(4.5) self.gripperMotor.grid(row=2, column=0) self.gripperForce = tools.Gauge(rightupper, width=180, height=150, min_value=0.0, max_value=5, label='GrForce', unit='mN', bg='gray40', red_low=70, yellow=100) self.gripperForce.set_value(4.5) self.gripperForce.grid(row=2, column=1) self.proximitySensor = tools.Gauge(rightupper, width=180, height=150, min_value=0.0, max_value=5, label='Contact', unit='mm', bg='gray40', yellow=100, red=100) self.proximitySensor.set_value(4.5) self.proximitySensor.grid(row=2, column=2) # ===============================END================================================ # ============================GRIPPER FORCE GRAPH==================================== rightLower = LabelFrame(rightFrame, bg='gray40', text='Gripper Force', font=('verdana', 10, 'bold')) rightLower.pack(fill=X) figure = Figure(figsize=(4.5, 2.5), dpi=100) figure.tight_layout(h_pad=5) subplot = figure.add_subplot(111) # subplot.set_xlabel('Time(s)') subplot.set_ylabel('Force(N)') subplot.plot([1, 2, 3, 4, 5, 6, 7, 8], [5, 6, 7, 5, 6, 1, 2, 3], color='orange') graphcanvas = FigureCanvasTkAgg(figure, rightLower) graphcanvas.draw() graphcanvas.get_tk_widget().pack(fill=X)
import tkinter as tk import tk_tools import serial import time root = tk.Tk() arduinoData = serial.Serial('com8', 9600) batV_gauge = tk_tools.Gauge( root, height=120, width=250, max_value=5, min_value=0, label='Bat voltage', unit='V', divisions=1, ) batV_gauge.grid(row=0, column=1, sticky='news') # initialization of some variables. count = 0 up = True def update_gauge(): global count, up increment = 30 if up:
# Discription : Data will tack from serialy and show it on Spedometer GUI from tkinter import * import tkinter as tk import datetime import tk_tools import serial root = tk.Tk() gauge = tk_tools.Gauge(root, width=500, height=300, min_value=0.0, max_value=200.0, label='speed', divisions=10, yellow=50, red=80, yellow_low=0, red_low=0, bg='white') gauge.grid() value = 0 def init_serial(): global ser ser = serial.Serial() ser.baudrate = 9600 ser.port = "COM0" #COM Port Name Start from 0 #Specify the TimeOut in seconds, so that SerialPort
position=RIGHT, row=6, col=2, on_press=on_press_right) btn_left = arrow_button("left_resize.png", position=LEFT, row=6, col=0, on_press=on_press_left) ###############################CONTROLLER################################## canvas_speed = Canvas(root, width=400, height=400, bg="white") canvas_speed.pack(side=BOTTOM) gauge = tk_tools.Gauge(canvas_speed, max_value=20, label='Vitesse', unit='cm/s') gauge.pack(side=TOP) gauge.set_value(10) slider = StringVar() slider.set('10.00') def change_scale(s): global gauge, vitesse vitesse = 500 * float(s) / 20 slider.set('%0.2f' % float(s)) gauge.set_value(float(s)) r.set("vitesse", vitesse)
button.grid(row=7, column=3) def set_speed_slider(): global EntrySlider1 global speed global master global gauge val = EntrySlider1.get() if int(val) < 0 or int(val) > 255: print("error: Speed must be GREATER than 1 and LESS THAN 255") print("current speed: " + str(speed)) else: speed = int(val) gauge.set_value(int(speed)) myMotor.run(Adafruit_MotorHAT.FORWARD) myMotor.setSpeed(int(speed)) print(speed) increase_speed_entrybox() decrease_speed_entrybox() decrease_percentage_speed_entrybox() increase_percentage_speed_entrybox() set_speed_entryslider() set_speed_entrybox() gauge = tk_tools.Gauge(master, max_value=255.0, label='speed', unit=' rmp/sec') gauge.grid(row=8, column=1) gauge.set_value(0) mainloop()
import tkinter as tk import tk_tools import random_logger as rl root = tk.Tk() # Typical one-sided gauge that you might be expecting for a # speedometer or tachometer. Starts at zero and goes to # max_value when full-scale. speed_gauge = tk_tools.Gauge(root, height=180, width=320, max_value=200, label='speed', unit=' km/h', divisions=10, red=60, yellow=40) speed_gauge.grid(row=0, column=0, sticky='news') tach_gauge = tk_tools.Gauge(root, height=180, width=320, max_value=8000, label='Taco Metri', unit=' RPM', divisions=10, red=65, yellow=60) tach_gauge.grid(row=1, column=0, sticky='news')
import tkinter as tk import tk_tools root = tk.Tk() max_speed = 20000 # Typical one-sided gauge that you might be expecting for a # speedometer or tachometer. Starts at zero and goes to # max_value when full-scale. speed_gauge = tk_tools.Gauge(root, max_value=max_speed, label='speed', unit=' m/h', bg='grey') speed_gauge.grid(row=0, column=0, sticky='news') tach_gauge = tk_tools.Gauge(root, max_value=8000, label='tach', unit=' RPM', divisions=10) tach_gauge.grid(row=1, column=0, sticky='news') strange_gauge = tk_tools.Gauge(root, max_value=30000, label='strange', unit=' blah', divisions=10, red=90, yellow=60) strange_gauge.grid(row=2, column=0, sticky='news') # The battery voltage gauge has a lower voltage limit and an
def create_widgets(self): global stop # Pack Voltage Gauge self.pvgauge = tk_tools.Gauge(self, height=200, width=400, min_value=10, max_value=20, label='Pack Voltage', unit=' V', divisions=30, yellow=66, red=70, yellow_low=43, red_low=40) #bg='grey') self.pvgauge.grid(row=0, column=5, rowspan=3, columnspan=3, sticky='news') # Speed Gauge self.spdgauge = tk_tools.Gauge(self, height=200, width=400, min_value=0, max_value=20, label='Speed', unit=' (kn)', divisions=20, yellow=50, red=70) #bg='grey') self.spdgauge.grid(row=0, column=2, rowspan=3, columnspan=3, sticky='news') #File Name Entry Box self.FiNaEn = Entry(self) self.FiNaEn.grid(row=1, column=0) #File name Label self.FiNaLa = Label(self, text="File name:") self.FiNaLa.grid(row=0, column=0, sticky='S') #Value Labels, Digits self.Mag_Compass_Label = Label(self, text="Mag Compass:"******"Target Heading:") self.Target_Heading_Label.grid(row=4, column=0, sticky='E') self.Target_Heading_Dig = tk_tools.SevenSegmentDigits( self, digits=10, background='black', digit_color='white', height=30) self.Target_Heading_Dig.grid(row=4, column=1, sticky='W', pady=4, ipady=2) self.GPS_Compass_Label = Label(self, text="GPS Compass:"******"Latitude:") self.Latitude_Label.grid(row=7, column=0, sticky='E') self.Latitude_Dig = tk_tools.SevenSegmentDigits(self, digits=10, background='black', digit_color='white', height=30) self.Latitude_Dig.grid(row=7, column=1, sticky='w', pady=4, ipady=2) self.Longitude_Label = Label(self, text="Longitude:") self.Longitude_Label.grid(row=8, column=0, sticky='E') self.Longitude_Dig = tk_tools.SevenSegmentDigits(self, digits=10, background='black', digit_color='white', height=30) self.Longitude_Dig.grid(row=8, column=1, sticky='w', pady=4, ipady=2) self.GPS_Speed_Label = Label(self, text="GPS Speed (kn):") self.GPS_Speed_Label.grid(row=9, column=0, sticky='E') self.GPS_Speed_Dig = tk_tools.SevenSegmentDigits(self, digits=10, background='black', digit_color='white', height=30) self.GPS_Speed_Dig.grid(row=9, column=1, sticky='w', pady=4, ipady=2) self.GPS_Distance_Label = Label(self, text="GPS Distance:") self.GPS_Distance_Label.grid(row=10, column=0, sticky='E') self.GPS_Distance_Dig = tk_tools.SevenSegmentDigits( self, digits=10, background='black', digit_color='white', height=30) self.GPS_Distance_Dig.grid(row=10, column=1, sticky='w', pady=4, ipady=2) #Jets Labels and Digits self.Port_Jet_Current_Label = Label(self, text="Port Jet Current:") self.Port_Jet_Current_Label.grid(row=3, column=2, sticky='NESW') self.Port_Jet_Current_Dig = tk_tools.SevenSegmentDigits( self, digits=10, background='black', digit_color='white', height=30) self.Port_Jet_Current_Dig.grid(row=4, column=2, sticky='NEWS', pady=4, ipady=2, padx=4, ipadx=2) self.Delta_Jet_Current_Label = Label(self, text="Jet Current Delta:") self.Delta_Jet_Current_Label.grid(row=3, column=3, sticky='NESW') self.Delta_Jet_Current_Dig = tk_tools.SevenSegmentDigits( self, digits=5, background='black', digit_color='white', height=30) self.Delta_Jet_Current_Dig.grid(row=4, column=3, sticky='NEWS', pady=4, ipady=2, padx=4, ipadx=2) self.Delta_Status_Led = tk_tools.Led(self, size=50) self.Delta_Status_Led.grid(row=5, column=3, sticky='NSEW', ipadx=10) self.Starboard_Jet_Current_Label = Label(self, text="Starboard Jet Current:") self.Starboard_Jet_Current_Label.grid(row=3, column=4, sticky='NESW') self.Starboard_Jet_Current_Dig = tk_tools.SevenSegmentDigits( self, digits=10, background='black', digit_color='white', height=30) self.Starboard_Jet_Current_Dig.grid(row=4, column=4, sticky='NEWS', pady=4, ipady=2, padx=4, ipadx=2) self.Log_Status_Led = tk_tools.Led(self, size=50) self.Log_Status_Led.grid(row=2, column=1, sticky='NSEW', ipadx=10) #Rotary Scale self.rs = tk_tools.RotaryScale(self, max_value=360, size=100, unit='deg') self.rs.grid(row=0, column=8, rowspan=3) #Start Log Button self.StLog = Button(self, text="Start Log", command=self.start_log) self.StLog.grid(row=2, column=0, sticky='N') self.Stop_Log = Checkbutton(self, text="Stop Logging", command=self.stop_log) self.Stop_Log.grid(row=0, column=1, sticky='N')
def output_UI(self, credit_dict): if credit_dict['PRFlag'] == "Y": derogatory = "Found Derogatory Marks on the record" else: derogatory = "No Derogatory Marks on the Record" util_percentage = round((int(credit_dict['totBalance']) * 100) / int(credit_dict['creditLimit'])) currentDateTime = datetime.datetime.now().strftime("%Y-%m-%d") currentDateTime = time.strptime(currentDateTime, "%Y-%m-%d") creditSincedate = time.strptime(credit_dict['active_since'], "%Y-%m-%d") yearsActive = currentDateTime.tm_year - creditSincedate.tm_year master = Tk() master.title("Credit Score Dashboard") master.configure(background='white') #Score Guage score_gauge = tk_tools.Gauge(master, height=250, width=500, max_value=850, min_value=350, label='Score', divisions=10, red_low=30, yellow_low=70, yellow=110, red=120, bg='white') score_gauge.grid(row=1, column=2, sticky='news') score_gauge.set_value(credit_dict['score']) Label(master, text="Your Credit Score is " + str(credit_dict['score']), font='Helvetica 18 bold').grid(row=2, column=2) Label(master, text="Active Since " + str(credit_dict['active_since']), font='Helvetica 18 bold').grid(row=3, column=2) Label(master, text="Total Inquiries are " + str(credit_dict['inquiries']), font='Helvetica 18 bold').grid(row=4, column=2) Label(master, text="Utilization percentage is " + str(util_percentage) + "%", font='Helvetica 18 bold').grid(row=5, column=2) Label(master, text=derogatory, font='Helvetica 18 bold').grid(row=6, column=2) Label(master, text="Missed Payments as of today are " + str(credit_dict['missedPayments']), font='Helvetica 18 bold').grid(row=7, column=2) #Inquiry Guage inquiry_gauge = tk_tools.Gauge(master, height=250, width=300, max_value=20, min_value=0, label='Inquiries', divisions=10, red_low=-1, yellow_low=-1, yellow=50, red=90, bg='white') inquiry_gauge.grid(row=8, column=1, sticky='news') inquiry_gauge.set_value(credit_dict['inquiries']) #Utilization Guage util_gauge = tk_tools.Gauge(master, height=250, width=500, max_value=100, min_value=0, label='Utilization', unit='%', divisions=10, red_low=-1, yellow_low=-1, yellow=30, red=60, bg='white') util_gauge.grid(row=8, column=2, sticky='news') util_gauge.set_value(util_percentage) #Missed Payments Guage payments_gauge = tk_tools.Gauge(master, height=250, width=300, max_value=100, min_value=0, label='Missed Payments', divisions=10, red_low=-1, yellow_low=-1, yellow=10, red=20, bg='white') payments_gauge.grid(row=8, column=3, sticky='news') payments_gauge.set_value(credit_dict['missedPayments']) #Active Since Guage active_since_gauge = tk_tools.Gauge(master, height=250, width=300, max_value=80, min_value=0, label='Years Active', unit="Years", divisions=16, red_low=4, yellow_low=8, yellow=110, red=120, bg='white') active_since_gauge.grid(row=8, column=4, sticky='news') active_since_gauge.set_value(yearsActive) mainloop()