文档没有真正提到如何删除窗口或面板;
curses的c api具有delwin
和del_panel
函数,但是python api中都不可用;这是否意味着在python中删除窗口的正确方法是简单地取消对所有窗口的链接,并对其进行垃圾回收?面板也一样吗?
我在Python del_panel
模块中调用curses.panel
的唯一位置是在deallocator中:
static void
PyCursesPanel_Dealloc(PyCursesPanelObject *po)
{
PyObject *obj = (PyObject *) panel_userptr(po->pan);
if (obj) {
(void)set_panel_userptr(po->pan, NULL);
Py_DECREF(obj);
}
(void)del_panel(po->pan);
if (po->wo != NULL) {
Py_DECREF(po->wo);
remove_lop(po);
}
PyObject_DEL(po);
}