Jan-06-2021, 05:00 PM
Script,
Now, and search start, calls out result_found or no_input
What I want to do, is delete result_lbl and then pack result_lbl again with new data.
I tried doing result_lbl.pack_forget()
but I can find where to put it!
If you don't understand this question, pls msg me.
And if I did something wrong, I'm really sorry. Im new to forums.
from tkinter import * main = Tk() main.title("1. Unit & Dimentions") #root.geometry("1600x800+0+0") #Var Details length = ["meter", "m"] mass = ["kilogram", "kg"] time = ["second", "s"] current = ["ampere", "A"] temperature = ["kelvin", "K"] amount_of_substance = ["mole", "mol"] luminous_intensity = ["candela", "cd"] Fundamentals = [length, mass, time, current, temperature, amount_of_substance, luminous_intensity] #Text name = Label(main, text = "1. Unit & Dimentions", font = ("arial", 45, "bold"), fg = "Steel Blue", bd = 10) mj = Label(main, text = "A product of MihiraJ.com", font = ("arial", 26, "bold"), fg = "#cc5c54", bd = 10) dev = Label(main, text = "Devloped by Oshadha Mihiranga", font = ("arial", 18, "bold"), fg = "Steel Blue", bd = 10) search = Label(main, text = "Search", font = ("arial", 10, "bold"), fg = "black", bd = 10) #Text boxes search_box = Entry(main, borderwidth = 4, width = 34) #Frames results = LabelFrame(main, text = "Results") rel_results = LabelFrame(main, text = "Related Results") #errors err001 = Label(results, text = "Err001 : Result not Found, Please type again.", fg = "#eb0000") #functions def no_input(): err001.pack(padx = 6, pady = 6, side = LEFT) def result_found(name, result): result_lbl = Label(results, text = "Physical quantity : " + name + "\nUnit : " + result[0] + "\nSymbol : " + result[1], justify = LEFT) result_lbl.pack(padx = 6, pady = 6, side = LEFT) def search_start(txt_2_search): if txt_2_search == "": no_input() if txt_2_search == "mass": result_found("Mass", mass) #buttons search_button = Button(main, text = "Start Search", command = lambda : search_start(search_box.get().lower())) #pack name.pack() mj.pack() search.pack() search_box.pack() search_button.pack() results.pack(fill = X) dev.pack() mainloop()So basically, when I click search_button , it calls out the function search_start.
Now, and search start, calls out result_found or no_input
What I want to do, is delete result_lbl and then pack result_lbl again with new data.
I tried doing result_lbl.pack_forget()
but I can find where to put it!
If you don't understand this question, pls msg me.
And if I did something wrong, I'm really sorry. Im new to forums.