Skip to content

Instantly share code, notes, and snippets.

@gazpachoking
Created October 17, 2012 21:33
Show Gist options
  • Select an option

  • Save gazpachoking/3908383 to your computer and use it in GitHub Desktop.

Select an option

Save gazpachoking/3908383 to your computer and use it in GitHub Desktop.
npyscreen test
import npyscreen
tree_data = npyscreen.NPSTreeData()
tree_data.newChild(content={'a': 1})
tree_data.newChild(content={'b': 2})
class MyTreeLineAnnotated(npyscreen.TreeLineAnnotated):
def getAnnotationAndColor(self):
# AHH, self.value is an empty str, this fails.
content = self.value.getContent()
return (self._annotate, self._annotatecolor)
def display_value(self, vl):
return str(vl)
class MyTree(npyscreen.MultiLineTreeNew):
_contained_widgets = MyTreeLineAnnotated
def display_value(self, vl):
return vl
class MyForm(npyscreen.Form):
def create(self):
self.series_view = self.add(MyTree, values=tree_data)
def myFunction(*args):
F = MyForm(name = "My Form")
F.edit()
npyscreen.wrapper_basic(myFunction)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment