No attribute "call" error in tkinter font

Viewed 2835

I am devoloping one desktop application using tkinter . Setting font raising exception .

tmp.py

def main(root):
    frame = Frame(root.master)
    font = Font(size=25 , weight="bold")
    label = Label(frame , font=font , text="tuna fish")
    label.pack()
    frame.pack()

this is driver program main.py main.py

if __name__ == "__main__":
    root = start.baseApp()
    root.Menu_Customer.add_command(label="New customer", command=lambda: tmp.main(root=root))
    root.master.mainloop()

baseApp

i have created root window and menu bar with name Customer and added menu item New customer in main.py.
i am getting the exception in tmp.pysaying

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib64/python3.5/tkinter/__init__.py", line 1559, in __call__
    return self.func(*args)
  File "main.py", line 10, in <lambda>
    root.Menu_Customer.add_command(label="New customer", command=lambda: tmp.main(root=root))
  File "/home/engle/Documents/Project/CleanMaster/tmp.py", line 6, in main
    font = Font(size=25 , weight="bold")
  File "/usr/lib64/python3.5/tkinter/font.py", line 93, in __init__
    tk.call("font", "create", self.name, *font)
AttributeError: 'NoneType' object has no attribute 'call'


whats wrong with it ?

1 Answers
Related