擅长:python、mysql、java
<p>您可以从另一个文件完全访问画布,但必须首先导入菜单.py把文件归档测试.py文件。文件下面的代码要求您菜单.py文件和测试.py(测试.pytest()函数所在的文件位于同一文件夹中。你知道吗</p>
<pre><code># This is in the test.py folder
import menu
def test():
menu.canvas.delete("all")
</code></pre>
<p>或者,您可以导入菜单.py归档到您的测试.py你知道吗</p>
<pre><code># This is in the test.py folder
from menu import *
def test():
canvas.delete("all")
</code></pre>
<p>希望这是有帮助的。你知道吗</p>