I have class which has ttk components. When i run this class from some reason it raise an error, AttributeError: 'Accounts' object has no attribute 'tk'
.
I cant understand why.
CODE
from tkinter import *
from tkinter import ttk, messagebox
import tkinter.font as tkfont
from database.db import Database
class Accounts:
def __init__(self, window):
self.window = window
self.username = StringVar()
self.password = StringVar()
self.name = StringVar()
self.phone = StringVar()
self.SAVE = 1
self.UPDATE = 0
self.headerFont = tkfont.Font(family="Helvetica", size=12, weight='bold')
self.titleFont = tkfont.Font(family="Helvetica", size=9)
self.h3 = tkfont.Font(family="Helvetica", size=11, weight='bold')
self.h4 = tkfont.Font(family="Helvetica", size=10, weight='bold')
self.bold = tkfont.Font(weight='bold', size=10)
self.list_box_text = tkfont.Font(family="Verdana", size=11, weight='bold')
# Add account form (left side)
ttk.Label(self, text='Manage your accounts', font=self.headerFont).grid(column=0, row=0, padx=10, pady=10)
ttk.Label(self, text='Add account', font=self.h3).grid(column=0, row=1, padx=10, pady=10, columnspan=2)
It is always crash on this line ttk.Label(self, text='Manage your accounts', font=self.headerFont).grid(column=0, row=0, padx=10, pady=10)
.
Cant understand why its crashing, I import ttk.
What am i doing wrong?