File "d:\B_05 Py\临时 copy.py", line 57, in qingkong self.e1.delete(0,'END') ^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'delete'
时间: 2023-08-03 11:09:03 浏览: 45
这个错误是因为你尝试在一个空的对象上调用 `.delete()` 方法。在你的代码中,`self.e1` 这个对象可能没有被正确地初始化或者没有被正确地关联到用户界面上的某个元素。请检查一下代码,确保在调用 `.delete()` 方法之前,`self.e1` 对象已经被正确地初始化并且已经与用户界面上的某个元素绑定。
相关问题
#include "stdafx.h"
#include "stdafx.h" 是一个预编译头文件,它包含了一些标准系统的头文件和项目特定的头文件。预编译头文件的作用是提前编译一些常用的代码,以加快编译速度。在stdafx.h中,可以看到它包含了一些头文件,包括stdio.h。所以,当我们在程序中包含stdafx.h时,实际上也包含了stdio.h和其他一些需要的头文件。这种做法在使用某些开发环境中是常见的。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [#include“stdafx.h”详解](https://blog.csdn.net/qingkong8832/article/details/6695123)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *2* [# include“stdafx.h” 介绍](https://blog.csdn.net/Kern5/article/details/127349762)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
tkinter 中 def createWidget(self): ''' 功能区 ''' Button(self,text=" 清 空 ",command=self.qingkong).grid(row=0,column=2,sticky=W, rowspan=10) Button(self,text=" 退 出 ",command=root.destroy).grid(row=0,c
olumn=3,sticky=W, rowspan=10)
这段代码是在一个继承自 tkinter.Frame 的类中定义的 createWidget 方法,用于创建该类的功能区。其中包含两个按钮,一个是“清空”按钮,一个是“退出”按钮。这两个按钮都是用 Button 类创建的,其中 text 参数用于指定按钮上的文字,command 参数用于指定按钮被点击时要执行的方法。在这里,清空按钮被点击时会执行该类的 qingkong 方法,退出按钮被点击时会执行 root 对象的 destroy 方法,从而关闭整个窗口。grid 方法用于将这两个按钮放置在窗口的指定位置。其中 row 和 column 参数指定了按钮在网格中的行列位置,sticky 参数指定了按钮在所在单元格中的对齐方式,rowspan 参数指定了按钮跨越的行数。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)