How do I delete the bound character which triggered callback?

Mudcat mnations at gmail.com
Mon Jan 31 20:06:21 EST 2005


Howdy,

I have a simple combox that I have commands entered into which looks
like this:

"""This is a list with the commands to be run in rotisserie
fasion."""
self.comList = Pmw.ComboBox(self.boxFrame, labelpos=W,
label_text='Command List: ', entry_width=20,
selectioncommand=self.temp )

self.comList.pack(side=LEFT)

self.comList.component('entry').bind(';', self.enterCommand)


I have bound the ';' key because that is the terminating character in
the protocol we are using, and once that is entered the entry is
complete. Basically it skips the normal methond this box uses to
capture commands.

However, I can't get rid of it once the call is made. This is what I'm
doing on the callback:

def enterCommand(self, widget):
# Get current list of commands, must convert to list
comTuple =  self.comList.get(0, END)
commandsList = list( comTuple)

# Get current command entered into the entry field
currentCommand = self.comList.component('entry').get()
currentCommand += ";"
print currentCommand

# Append new entry into current list and set the new list
commandsList.append(currentCommand)
self.comList.setlist( commandsList )

self.comList.component('entryfield').delete(0,END)

At the end of this function I want to completely erase everything in
the entryfield. However it erases everything but the bound key, ';'.
Does anyone know how to erase that one as well?

Thanks,
Marc




More information about the Python-list mailing list