Tkinter Frame不会正确销毁() [英] Tkinter Frame won't destroy() correctly

查看:956
本文介绍了Tkinter Frame不会正确销毁()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

对于我的生活,我无法理解为什么会发生这种情况,但每当我尝试.destroy()这个小部件(或其父节点)我的程序挂起时 - 它没有崩溃,它只是停止响应所以我必须强行杀死它。

Python 2.6.5,Windows 7

Hi all,
For the life of me I cannot work out why this is occuring but whenever I try to .destroy() this widget (or its parent) my program hangs - it doesn''t crash, it just stops responding so I have to force kill it.
Python 2.6.5, Windows 7

展开 | 选择 | Wrap | 行号

推荐答案

方法 self.create()返回什么? self.contacts_made 应该是 user 个实例的列表。

destroy()是一种通用的widget方法。它应该工作。没有所有的测试代码,有时很难看到问题。
What does method self.create() return? self.contacts_made should be a list of user instances.

destroy() is a universal widget method. It should work. Without having all the code for testing, it''s sometimes hard to see a problem.


啊,我的坏。包含创建功能是有道理的... ...


我还在生产函数中添加了一些奇怪的设置。


谢谢
Ah, my bad. Would make sense to include the create function... :)

I also added in the produce function in case that is making some odd settings.

Thanks


jinsue,


我没有看到任何突出的东西,但我无法测试代码。

您应该将类​​用户的名称大写。建议用于命名类。


尝试直接在窗口小部件上调用 destroy()而不是实例方法。这可以通过继承Tkinter.Frame来完成。示例:
jinsue,

I don''t see anything that sticks out, but I have no way to test the code.
You should capitalize the name of the class User. This is recommended for naming classes.

Try calling destroy() directly on the widget instead of in an instance method. This can be accomplished by inheriting from Tkinter.Frame. Example:
展开 | 选择 | Wrap | 行号


这篇关于Tkinter Frame不会正确销毁()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆