[chimera-dev] GUI question
Daniel Gurnon
danielgurnon at depauw.edu
Thu Oct 26 10:29:41 PDT 2017
Hi everyone,
I'm working with a undergraduate computer science student, Shuto Araki, on
a Chimera development project that involves creating a GUI. I'm not a
programmer, and he's learning Python as he goes- so we've run into the
inevitable snag, and we're looking for some help.
Here's how Shuto describes the issue:
----
I am trying to create a Chimera GUI extension that asks Chimera to fetch a
PDB ID and then to highlight residue positions within the structure, with
the PDB and positions taken from a CSV file. I started with a Python
script, and it works as intended if I import it from IDLE.
However, when I tried to create a GUI using this guide
https://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/
Examples/Main_ExtensionUI.html
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.
The code snippet is as follows:
##############################################################
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)
##############################################################
I suspect that MutationDialog class is not working as a proper callback
class.
*Do you have any suggestions for the proper structure of the class?*
We're also
Sincerely,
Shuto
---
Thanks for any advice!
Dan
____________________________
Daniel Gurnon, Ph. D.
Associate Professor of Chemistry and Biochemistry
Director, Science Research Fellows Program
DePauw University
Greencastle, IN 46135
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20171026/052c61e6/attachment-0001.html>
More information about the Chimera-dev
mailing list