Python 当我尝试使用标签在tkinter上上传图像时,我遇到了一个错误

Python 当我尝试使用标签在tkinter上上传图像时,我遇到了一个错误,python,tkinter,Python,Tkinter,我尝试使用tkinter上载图像时出错 我下载了一个gif图像,并将其保存在名为“image.gif”的文件中,并将该图像保存为“image” 我收到的错误消息是“权限被拒绝” 您忘记声明root-root=Tk()。Tk系统在使用前必须打开 在stackoverflow搜索框中键入准确的错误,您将找到答案。 #Add a picture using label logo = PhotoImage(file="img.gif") w1 = Label(news_window, image=l

我尝试使用tkinter上载图像时出错 我下载了一个gif图像,并将其保存在名为“image.gif”的文件中,并将该图像保存为“image”

我收到的错误消息是“权限被拒绝”

您忘记声明root-root=Tk()。Tk系统在使用前必须打开


在stackoverflow搜索框中键入准确的错误,您将找到答案。
#Add a picture using label

logo = PhotoImage(file="img.gif")

w1 = Label(news_window, image=logo).pack(side="right")

w2 = Label(news_window, 
              justify=RIGHT,
              padx = 10, 
              text=explanation).pack(side="right")