Jan-13-2021, 06:23 AM
Script,
It makes no sense to me!
from tkinter import * main = Tk() main.title("1. Unit & Dimentions") #root.geometry("1600x800+0+0") #Var Details length = ["meter", "m", "fundamentals"] mass = ["kilogram", "kg", "fundamentals"] time = ["second", "s", "fundamentals"] current = ["ampere", "A", "fundamentals"] temperature = ["kelvin", "K", "fundamentals"] amount_of_substance = ["mole", "mol", "fundamentals"] luminous_intensity = ["candela", "cd", "fundamentals"] 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) result_lbl = Label() #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) search_box.delete(0, END) def result_found(name, result): search_box.delete(0, END) result_lbl.config(results, text = "Physical quantity : " + name + "\nUnit : " + result[0] + "\nSymbol : " + result[1], justify = 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) result_lbl.pack(padx = 6, pady = 6, side = LEFT) dev.pack() mainloop()
Error:Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 1885, in __call__
return self.func(*args)
File "D:\3. My folder\Projects\Programing\Python\4. MihiraJ Projects\1. Unit And Dimentions.py", line 52, in <lambda>
search_button = Button(main, text = "Start Search", command = lambda : search_start(search_box.get().lower()))
File "D:\3. My folder\Projects\Programing\Python\4. MihiraJ Projects\1. Unit And Dimentions.py", line 48, in search_start
result_found("Mass", mass)
File "D:\3. My folder\Projects\Programing\Python\4. MihiraJ Projects\1. Unit And Dimentions.py", line 42, in result_found
result_lbl.config(results, text = "Physical quantity : " + name + "\nUnit : " + result[0] + "\nSymbol : " + result[1], justify = LEFT)
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 1639, in configure
return self._configure('configure', cnf, kw)
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 1629, in _configure
self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
_tkinter.TclError: unknown option "-class"
What is this error?It makes no sense to me!