Im trying to build an .exe file with auto py to exe. In PyCharm code I provided works fine and the font is displayed correctly but when I build exe file and run it, I get this error:
FileNotFoundError: [WinError 2]: 'C:\\Users\\test\\AppData\\Local\\Temp\\_MEI21562\\tkextrafont'
What can I do to fix it, so myapp.exe displays font correctly ?
from tkinter import Tk, Label
from tkextrafont import Font
def resource_path(relative_path):
base_path = getattr(sys, "_MEIPASS", os.path.dirname(os.path.abspath(__file__)))
return os.path.join(base_path, relative_path)
root = Tk()
font_reg = Font(file=resource_path('./font/Manrope-Regular.ttf'), family='Manrope')
label = Label(text="test",font=('Manrope', 30, 'bold'))
label.pack()
root.mainloop()
tried changing paths, with and without the resource_path function, nothing works.