-
Notifications
You must be signed in to change notification settings - Fork 90
Gui to show dictionary values
tlinnet edited this page Apr 18, 2013
·
3 revisions
If you have the enthought python distribution, or install traits+traitsui, I found this little snippet of code for a dictionary viewer.
you can then examine your NMR glue dictionary, by writing
import gui
gui.dic(mydic)
from traits.api import HasTraits, Instance
from traitsui.api import View, VGroup, Item, ValueEditor
class DictEditor(HasTraits):
Object = Instance( object )
def __init__(self, obj, **traits):
super(DictEditor, self).__init__(**traits)
self.Object = obj
def trait_view(self, name=None, view_elements=None):
return View(
VGroup(
Item('Object',
label = 'Debug',
id = 'debug',
editor =ValueEditor(), #ValueEditor()
style = 'custom',
dock = 'horizontal',
show_label = False),),
title = 'Dictionary Editor',
width = 800,
height = 600,
resizable = True)
def dic(my_data):
b = DictEditor(my_data)
b.configure_traits()
or use this code
from nmrglue.util import dicgui
dicgui.dic(dic)