0

我使用easygui multenterbox它是为了让用户可以选择从正在复制的数据中编辑特定信息。我唯一的问题是按“退格”会导致将“\b”添加到字符串中,而不是删除一个字符。有没有人想出一种方法来将<backspace>事件添加到 multenterbox 内的字段中?
我过去曾在 tkinter "Entry" 和 "Text" 上使用过这个事件。

示例代码:

msg         = "Enter name"
            title       = "New name"
            fieldName  = ['name']


            newTitle= 'NewName'

            fieldValue = [newName]  
            fieldValue = multenterbox(msg,title, fieldName,fieldValue)

            # make sure that none of the fields were left blank
            while 1:  # do forever, until we find acceptable values and break out
                if fieldValue == None: 
                    break
                errmsg = ""
                # look for errors in the returned values
                for i in range(len(fieldName)):
                    if fieldValue[i].strip() == "":
                        errmsg = errmsg + '"{}" is a required field.\n\n'.format(fieldName[i])
                if errmsg == "": 
                    # no problems found
                    print ("Reply was:", fieldValue)
                    break 
                else:
                    # show the box again, with the errmsg as the message    
                    fieldValue = multenterbox(errmsg, title, fieldName, fieldValue)

上面的代码片段显示了我已经拥有并且有效的功能。我的程序将打开一个带有 NewTitle 值的多框窗口,用户可以对其进行编辑。如何控制 multenterbox 中的可编辑条目以使其支持退格?

谢谢,嗯

4

0 回答 0