_tkinter.TclError: image "pyimage1" doesn't exist 解决办法

1     def logout(self):
2         login.LoginWindow().showLoginWindow()#显示登录界面

当我想实现一个注销的功能时,我实现了上面的两个方法,但是当我运行,却报错了,如下:

Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\jums\AppData\Local\Programs\Python\Python37\lib\tkinter\__init__.py", line 1705, in __call__
return self.func(*args)
File "G:\software\pycharm\files\Windows\Applications.py", line 60, in logout
login.LoginWindow().showLoginWindow()
File "G:\software\pycharm\files\Windows\login.py", line 21, in showLoginWindow
image = self.canvas.create_image(0, 0, image=self.image_file, anchor="nw")
File "C:\Users\jums\AppData\Local\Programs\Python\Python37\lib\tkinter\__init__.py", line 2489, in create_image
return self._create('image', args, kw)
File "C:\Users\jums\AppData\Local\Programs\Python\Python37\lib\tkinter\__init__.py", line 2480, in _create
*(args + self._options(cnf, kw))))
_tkinter.TclError: image "pyimage1" doesn't exist

后来发现,一个tkinter程序,只允许有一个Tk()对象,我们这里在第一个Tk()对象还存在时有调用另外一个,所以就产生了这个错误,我们只要在调用第二个Tk()对象之前,将第一个销毁就可以了,代码如下:

     def logout(self):
         self.root.destroy()#将当前的Tk()对象销毁 一个程序只允许有一个Tk()
         login.LoginWindow().showLoginWindow()

这样就可以了。

_tkinter.TclError: image "pyimage1" doesn't exist 解决办法的更多相关文章

  1. Mysql创建表时报错Table doesn't exist解决办法

    最近做项目时,本地数据库出了毛病,PHPMyadmin中有几张表不见了,我想应该是误删了吧,于是准备重新建一张表,可是问题出现了,sql报错,说表不存在... 什么鬼!就是因为表不存在我才要创建的好吗 ...

  2. postgre数据库插入错误:prepared statement “S_1”already exist, 解决办法

    在使用kettle工具(数据迁移软件)在postgre数据库中插入记录时,出现如下错误,解决办法: 在/etc/pgsql/pgbouncer.ini中修改配置,设置 server_reset_que ...

  3. MySQL中报错: [Err] 1146 - Table 'performance_schema.session_status' doesn't exist 解决办法

    解决办法:1.打开cmd 执行命令cd/ 进入C盘根目录2.dir 查看C盘根目录下文件夹  找到 Program Files文件夹3.cd Program Files 进入该文件夹下 再输入dir ...

  4. java 执行mysql 8.0.11存储过程报错The user specified as a definer ('root'@'10.%.%.%') does not exist解决办法

    执行存储过程,报错 java.sql.SQLException: The user specified as a definer ('root'@'10.%.%.%') does not exist ...

  5. ERROR: column "xxxxxx" does not exist解决办法

    今天在写PostgreSQL语句时候发现运行这个代码 SELECT t1.equipid, t2.equipname, t1.bigtype, t1.smalltype FROM pdw_gh_pro ...

  6. Python编译遇到的一些错误及解决办法

    nunicodeessscape codec can't decode bytes in position2-3:truncated\UXXXXXXXX escape 描述:im=Image.open ...

  7. 【js】react-native Could not find iPhone 6 simulator 和 Entry, ":CFBundleIdentifier", Does Not Exist 两种报错解决办法

    一.在运行rn app应用时,react-native run:ios 报错出现   Could not find iPhone 6 simulator  解决办法: 1.react-native r ...

  8. github + SourceTree管理自己的库并上传到cocoapods及各种坑的解决办法

    一.上传写好的库到github(我这里使用SourceTree客户端) 1.在github上创建一个仓库 2.将仓库拉倒本地 复制仓库地址 将刚才复制的地址粘贴到这里 3.上传项目到github 将写 ...

  9. Linux中安装Oracle11g后出现监听的问题及解决办法

    软件安装: 参考文章: linux安装Oracle11G 错误如下: [oracle@iz2f570bi1k56uz admin]$ lsnrctl start LSNRCTL for Linux: ...

随机推荐

  1. idea下启动tomcat时,打印的日志中文乱码

    idea2018.2+tomcat8+java8+win10 异常:将编码方式全都修改为UTF-8后,且tomcat的VM启动参数中配置了:-Dfile.encoding=UTF-8.导致控制台日志打 ...

  2. WM_PAINT和WM_ERASEBKGND消息

    1.OnPaint()函数是窗口重绘消息WM_PAINT的响应函数,当窗口重绘时会产生WM_ERASEBKGND消息和WM_PAINT消息,而且WM_ERASEBKGND会先于WM_PAINT产生,所 ...

  3. python3.4读取excel数据绘图

    #!/usr/bin/env python # -*- coding:utf-8 -*- # __author__ = "blzhu" """ pyt ...

  4. Comment类型

    注释在DOM中是通过Comment类型来表示的. nodeType 8 nodeName #Comment nodeValue 注释的内容 parentNode 可能是Document或Element ...

  5. Redis-环境搭建

    Redis官方不提供Windows版,不过微软开源组织提供了Windows版本的Redis,此处将安装Windows版的Reids,供学习使用. 1.下载Windows版Redis安装包: 安装包地址 ...

  6. mysql碰到unknown variable 'xxxx' 的解决方法

    在使用mysqlbinlog查看日志的时候碰到了一个问题, 错误提示如下: /usr/local/mysql/bin/mysqlbinlog: unknown variable 'default-ch ...

  7. oracle 11g中文乱码解决的办法一

    oracle中文乱码解决的办法 正常安装完oracle客户端后,插入数据时,发现中文都是问号. PLL/SQL中输入select userenv('LANGUAGE') From Dual,结果为AM ...

  8. 【王者荣耀之IT大神版】铭文说明

    铭文共分五级: 一级:仅有老师提供的笔记 二级:添加了自己的听课笔记 三级:添加问题+解决方案(常遇到的问题以及自己实践上遇到的问题,排位赛遇到的遗忘点) 四级:熟记铭文与并添加联想学过的知识 五级: ...

  9. 如果我写一个开源的HIS软件

    HIS也称为医院信息管理系统,如果我要写一个 开源的,会成吗?为什么要这么做?出于对这个行业的担忧及其当前该行业的一些问题的思考.我曾跟两个HIS供应商讨论过这个话题,但可以感受到他们在利益面前,最终 ...

  10. How to resolve "your security settings have blocked an untrusted application from running" in Mac

    If you encounter the error "your security settings have blocked an untrusted application from r ...