-1
Good afternoon!
I’m trying to develop a project/idea I had, only when I went to put the "menubar" in other "parts of the programme" the program does not "whether" run further, can anyone help me resolve this error?
Error:
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python3.7/tkinter/__init__.py", line 1705, in __call__
return self.func(*args)
File "ajuda_redes.py", line 21, in ajuda_redes
ajuda.add_command(label='URLs', command=mostrar_urls)
NameError: name 'mostrar_urls' is not defined
Yes, I did give from import mostrar_urls *
in help_networks.py
And yes, the files show_urls.py and help_networks.py are in the same folder.
EDIT(1):
Error:
Traceback (most recent call last):
File "deep-web-url-aleatoria-develop/src/main.py", line 6, in <module>
from mostrar_urls import mostrar_urls
File "deep-web-url-aleatoria-develop/src/mostrar_urls.py", line 5, in <module>
from ajuda_redes import ajuda_redes
File "deep-web-url-aleatoria-develop/src/ajuda_redes.py", line 5, in <module>
from mostrar_urls import mostrar_urls
ImportError: cannot import name 'mostrar_urls' from 'mostrar_urls' (deep-web-url-aleatoria-develop/src/mostrar_urls.py)
EDIT(2):
Guys, I was able to solve the error(s), I switched the "snippets" who were "making a mistake":
from arquivo_exemplo import funcao_exemplo
p/ import funcao_exemplo
exemplo.add_command(label='exemplo', command=funcao_exemplo)
p/ exemplo.add_command(label='exemplo', command=arquivo_exemplo.funcao_exemplo)
I just don’t understand why I can’t put in all three files (main.py
, mostrar_urls.py
and ajuda_redes.py
) otherwise (recommended by PEP8):
from arquivo_exemplo import funcao_exemplo
exemplo.add_command(label='exemplo', command=funcao_exemplo)
Thus "gives" the Import of EDIT(1), unless it is placed only in main.py
.
If you need to link one branch entire in your question, you urgently need to read about creating a [mcve].
– Woss
@Andersoncarloswoss, okay, thanks for the tip.
– João Vítor