I ran into an error. When I click on the button that I added on toolbar, the callback function does not seem to work properly. It just pops up an empty window with OK, Apply and Cancel buttons.
class MutationDialog(ModelessDialog):
name = "mutation highlighter"
title = "Rare Genetic Mutation Highlighter”
master = Tk()
master.title("Rare Genetic Disease Mutation Highlighter")
master.geometry('{}x{}'.format(500, 100))
global var
var = StringVar(master)
var.set(proteinNames[0])
# proteinNames is a list of protein options that a user chooses
options = OptionMenu(master, var, *proteinNames)
options.pack()
def Apply():
# this functionality works
protein_num = proteinMap[var.get()]
mh.highlightMutation(filename, protein_num)
button = Button(master, text = "Apply", command = Apply)
button.pack()
chimera.dialogs.register(MutationDialog.name, MutationDialog)
dir, file = os.path.split(__file__)
icon = os.path.join(dir, 'ExtensionUI.tiff')
chimera.tkgui.app.toolbar.add(icon, lambda d=chimera.dialogs.display,
n=MutationDialog.name: d(n), 'Highlight Mutations', None)