如何解决VS代码无法在我的目录中找到我的图像资产
嘿,谢谢您的光临!
我对VS Code有问题。我试图从PyCharm过渡到VS Code,以便可以使用它们的插件,但是,当我尝试在VS Studio中运行代码时(过去在Pycharm中运行得很好),我遇到了错误。
该错误是由于某些原因,Vs Studio代码无法找到我存储在目录中的图像。下面是所有相关代码以及找到的错误消息。
# Importing relevant modules
import tkinter as tk
import sqlite3
from tkinter import messagebox
from PIL import ImageTk,Image
# Class for the Main Window
class masterWindow:
# Function for initialising the Master Window
def __init__(self,master):
self.master = master
self.frame = tk.Frame(self.master)
self.master.title("HealthSync")
self.master.geometry("500x500")
self.master.iconbitmap("Assets/PLACEHOLDER_LOGO.ico") #<----------------------------
self.master.resizable(width=False,height=False)
self.app_Logo = ImageTk.PhotoImage(Image.open("Assets/PLACEHOLDER_LOGO.png")) #<-----
self.logo_Label = tk.Label(image=self.app_Logo)
self.logo_Label.pack()
错误消息:
Traceback (most recent call last):
File "c:/Users/User/PycharmProjects/Python_Projects/TKinter Practise/(GROUP 4) 1191102618_Registration.py",line 150,in <module>
main()
File "c:/Users/User/PycharmProjects/Python_Projects/TKinter Practise/(GROUP 4) 1191102618_Registration.py",line 146,in main
app = masterWindow(root)
File "c:/Users/User/PycharmProjects/Python_Projects/TKinter Practise/(GROUP 4) 1191102618_Registration.py",line 15,in __init__
self.master.iconbitmap("Assets/PLACEHOLDER_LOGO.ico")
File "C:\python\lib\tkinter\__init__.py",line 1865,in wm_iconbitmap
return self.tk.call('wm','iconbitmap',self._w,bitmap)
_tkinter.TclError: bitmap "Assets/PLACEHOLDER_LOGO.ico" not defined #<-----------------------
PS C:\Users\User\PycharmProjects>
请注意,资产位于写入的目录文件夹中,并且在PyCharm上显示得很好。这是从Pycharm到VS Code的直接一对一代码。
再次感谢您的光临,并感谢您的协助。请在下面告知您需要进行的任何澄清,但请记住,我是一名编程专业的学生,还不是行业专业人士
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。