I'm trying to create separate sources for my project in a given .py file, after creating them I import to the project.py, I do this as follows:
font.py
"""
Criando as fontes.
"""
def fontes(self):
self.font1=("Arial", "60")
project.py
from Tkinter import *
from fonte import *
class base:
def __init__(self, janela):
caixa=Frame(janela)
caixa.pack()
a=Label(caixa, text="teste para o funcionamento das fontes", font=self.font1)
a.pack()
root=Tk()
base(root)
root.mainloop()
But when I try to use the font:
a = Label(caixa, text="teste para o funcionamento das fontes", font=font1)
It is giving error and says that it is not global:
NameError: global name 'font1' is not defined
Can anyone tell me how I can use fonts without being inside the project itself?