Python 用自己的方法诅咒菜单模块

Python 用自己的方法诅咒菜单模块,python,python-curses,Python,Python Curses,我目前正在尝试为我的程序运行一个小的控制台菜单。 我发现诅咒菜单模块打开了,并试着用它碰碰运气 curses菜单有一个FunctionItem,它调用python函数,但遗憾的是,我在控制台上看不到输出。下面是我的示例代码: # Import the necessary packages from cursesmenu import * from cursesmenu.items import * def hello(x): print("Hello {}".format(x)) #

我目前正在尝试为我的程序运行一个小的控制台菜单。 我发现诅咒菜单模块打开了,并试着用它碰碰运气

curses菜单有一个
FunctionItem
,它调用python函数,但遗憾的是,我在控制台上看不到输出。下面是我的示例代码:

# Import the necessary packages
from cursesmenu import *
from cursesmenu.items import *

def hello(x):
    print("Hello {}".format(x))

# Create the menu
menu = CursesMenu("Title", "Subtitle")

# Create some items

# A FunctionItem runs a Python function when selected
function_item = FunctionItem("Call a Python function", hello, [3])

# Once we're done creating them, we just add the items to the menu
menu.append_item(function_item)

# Finally, we call show to show the menu and allow the user to interact
menu.show()
hello
是以
3
作为参数调用的,它也创建了输出,但我在控制台上看不到它,因为菜单仍然在那里


可悲的是,我现在不知道该怎么处理它。如果有人能帮我解决这个问题,或者告诉我一个更好的控制台菜单模块,我会很高兴的。

要获得更易于使用的python文本用户界面库,请看一看


如果你真的想使用诅咒菜单扩展,你需要投入学习时间来学习诅咒,因为它不容易使用。看一看这张照片。它教授C语言的ncurses编程。在学习了curses的基础知识以及如何使用C语言中的curses菜单扩展后,您可以将所学内容转换为python。

谢谢,我将介绍pythondialog。诅咒只是第一个说服我尝试的模块。