0

I'm making a program that gets user input and then exports it into an excel sheet where it performs all the calculations. I've made a button that exports all the data to excel, then another button that then checks a cell value, and if the value is within a range, the background color changes so I don't have to go open my excel file.

What I'm having trouble is, auto updating values displayed on the GUI. My real code is way too long to past here so a very dumbed down version is pasted below. I've also attached an image that shows what I'm wanting my end result to be. I've seen videos about making calculators, but that's simple because the button has a command function in it. I really don't know how to get my end result and any suggestions are welcomed.

[![Picture of what I'm trying to do][1]][1]

from tkinter import *



#main Window using Tk
win = Tk()

win.title("Building")
win.geometry('800x480')


#Labels
L0= Label(win, text = "Bay 1")
L1= Label(win, text = "Bay 2")
L2= Label(win, text = "Bay 3")
L3= Label(win, text = "Bay 4")
L4= Label(win, text = "Bay 5")
L5= Label(win, text = "Ft")
L6= Label(win, text = "Ft")
L7= Label(win, text = "Ft")
L8= Label(win, text = "Ft")
L9= Label(win, text = "Ft")
L10= Label(win,text ="Building Length:")
L11= Label(win,text = "Length:")

#Place Labels
L0.place(y=50)
L1.place(y=80)
L2.place(y=110)
L3.place(y=140)
L4.place(y=170)
L5.place(x=100,y=50)
L6.place(x=100,y=80)
L7.place(x=100,y=110)
L8.place(x=100,y=140)
L9.place(x=100,y=170)
L10.place(y=30)
L11.place(y=250)

#Entries
E0= Entry(win,width=5)
E1= Entry(win,width=5)
E2= Entry(win,width=5)
E3= Entry(win,width=5)
E4= Entry(win,width=5)
E5= Entry(win,width=10)
E6= Entry(win,width=5)


#Place Entries
E0.place(x=50,y=50)
E1.place(x=50,y=80)
E2.place(x=50,y=110)
E3.place(x=50,y=140)
E4.place(x=50,y=170)
E5.place(x=50, y=250)
E6.place(x=100, y=30)


win.mainloop()

```enter image description here


  [1]: https://i.stack.imgur.com/2umLS.png

1 Answers1

0

Is this what you want?

def updated:
    ##The code to run whenever the entry field is modified

E0= Entry(win, width=5, command = updated) ##The entry field you would like to detect updates in

Let me know if this is what you need

TheFluffDragon9
  • 514
  • 5
  • 11