Commit c8266298 by Steven Bird

fixed incorrect tree initialization, now uses fromstring

parent 2905533c
...@@ -877,7 +877,7 @@ def demo(): ...@@ -877,7 +877,7 @@ def demo():
cf = CanvasFrame(width=550, height=450, closeenough=2) cf = CanvasFrame(width=550, height=450, closeenough=2)
t = Tree(''' t = Tree.fromstring('''
(S (NP the very big cat) (S (NP the very big cat)
(VP (Adv sorta) (V saw) (NP (Det the) (N dog))))''') (VP (Adv sorta) (V saw) (NP (Det the) (N dog))))''')
...@@ -896,7 +896,7 @@ def demo(): ...@@ -896,7 +896,7 @@ def demo():
return OvalWidget(canvas, TextWidget(canvas, text), return OvalWidget(canvas, TextWidget(canvas, text),
fill='cyan') fill='cyan')
treetok = Tree('(S (NP this tree) (VP (V is) (AdjP shapeable)))') treetok = Tree.fromstring('(S (NP this tree) (VP (V is) (AdjP shapeable)))')
tc2 = TreeWidget(cf.canvas(), treetok, boxit, ovalit, shapeable=1) tc2 = TreeWidget(cf.canvas(), treetok, boxit, ovalit, shapeable=1)
def color(node): def color(node):
...@@ -914,7 +914,7 @@ def demo(): ...@@ -914,7 +914,7 @@ def demo():
paren = ParenWidget(cf.canvas(), tc2) paren = ParenWidget(cf.canvas(), tc2)
cf.add_widget(paren, tc.bbox()[2]+10, 10) cf.add_widget(paren, tc.bbox()[2]+10, 10)
tree3 = Tree(''' tree3 = Tree.fromstring('''
(S (NP this tree) (AUX was) (S (NP this tree) (AUX was)
(VP (V built) (PP (P with) (NP (N tree_to_treesegment)))))''') (VP (V built) (PP (P with) (NP (N tree_to_treesegment)))))''')
tc3 = tree_to_treesegment(cf.canvas(), tree3, tree_color='green4', tc3 = tree_to_treesegment(cf.canvas(), tree3, tree_color='green4',
...@@ -949,7 +949,7 @@ built from tree_to_treesegment.""" ...@@ -949,7 +949,7 @@ built from tree_to_treesegment."""
textbox = BoxWidget(cf.canvas(), twidget, fill='white', draggable=1) textbox = BoxWidget(cf.canvas(), twidget, fill='white', draggable=1)
cf.add_widget(textbox, tc3.bbox()[2]+10, tc2.bbox()[3]+10) cf.add_widget(textbox, tc3.bbox()[2]+10, tc2.bbox()[3]+10)
tree4 = Tree('(S (NP this tree) (VP (V is) (Adj horizontal)))') tree4 = Tree.fromstring('(S (NP this tree) (VP (V is) (Adj horizontal)))')
tc4 = TreeWidget(cf.canvas(), tree4, draggable=1, tc4 = TreeWidget(cf.canvas(), tree4, draggable=1,
line_color='brown2', roof_color='brown2', line_color='brown2', roof_color='brown2',
node_font=('helvetica', -12, 'bold'), node_font=('helvetica', -12, 'bold'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment