Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 其他计算机上的背景tkinter_Python 3.x - Fatal编程技术网

Python 3.x 其他计算机上的背景tkinter

Python 3.x 其他计算机上的背景tkinter,python-3.x,Python 3.x,我是一个初学者,有一个问题。我做了一个exe文件,里面有我的代码和一切。在我将它传输到另一台计算机后,我得到了一个失败的脚本错误。可以理解,因为我在本地计算机上链接了一个图像 你知道一种链接图像或导入图像的简单方法吗?我可以在其他计算机上用背景来创建我的程序 Python 3.4 谢谢你们 C = Canvas(frank, bg="blue", height=250, width=300) filename = PhotoImage(file = "G:\\frankscripts\opdra

我是一个初学者,有一个问题。我做了一个exe文件,里面有我的代码和一切。在我将它传输到另一台计算机后,我得到了一个失败的脚本错误。可以理解,因为我在本地计算机上链接了一个图像

你知道一种链接图像或导入图像的简单方法吗?我可以在其他计算机上用背景来创建我的程序

Python 3.4

谢谢你们

C = Canvas(frank, bg="blue", height=250, width=300)
filename = PhotoImage(file = "G:\\frankscripts\opdrachten\giphy.gif")
background_label = Label(frank, image=filename)
background_label.place(x=0, y=0, relwidth=1, relheight=1)
C.pack()

您使用哪个工具将脚本转换为可执行文件?有人尝试使用
PyInstaller
。如果图像与脚本位于同一文件夹中,则只需传递一个相对路径:
filename=PhotoImage(file=“giphy.gif”)
,最后只需将图像放在可执行文件的一侧。@ventisei我也使用了PyInstaller。似乎确实不可能把它放在一个文件中。我会试试你的链接。@eyllanesc thanx,但我知道。问题是我只需要1个exe文件,不需要其他文件您使用了哪个工具将脚本转换为可执行文件?有人尝试使用
PyInstaller
。如果图像与脚本位于同一文件夹中,则只需传递一个相对路径:
filename=PhotoImage(file=“giphy.gif”)
,最后只需将图像放在可执行文件的一侧。@ventisei我也使用了PyInstaller。似乎确实不可能把它放在一个文件中。我会试试你的链接。@eyllanesc thanx,但我知道。问题是我只想要一个exe文件,没有其他文件