Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当用户在顶层窗口中单击系统提供的关闭按钮时,我需要释放资源。
问题:我如何拦截这个事件,以便我可以调用我自己的一些代码?
我浏览了文档,但找不到任何关于破坏顶层窗口的信息。
use warnings; use strict; use Tkx; my $mw = Tkx::widget->new('.'); $mw->g_wm_protocol('WM_DELETE_WINDOW' => \&cleanUp); Tkx::MainLoop(); sub cleanUp { print "Cleaning things up\n"; exit; }