Skip to content

Commit 0cd5fb5

Browse files
committed
Allow changes to menu choices
1 parent 86c5b9f commit 0cd5fb5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

vpython/vpython.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
'right':'q', 'top':'r', 'bottom':'s', '_cloneid':'t',
9898
'logx':'u', 'logy':'v', 'dot':'w', 'dot_radius':'x',
9999
'markers':'y', 'legend':'z', 'label':'A', 'delta':'B', 'marker_color':'C',
100-
'size_units':'D', 'userpan':'E', 'scroll':'F'}
100+
'size_units':'D', 'userpan':'E', 'scroll':'F', 'choices':'G'}
101101

102102
# methods are X in {'m': '23X....'}
103103
# pos is normally updated as an attribute, but for interval-based trails, it is updated (multiply) as a method
@@ -113,7 +113,7 @@
113113
'marker_color']
114114

115115
__textattrs = ['text', 'align', 'caption', 'title', 'xtitle', 'ytitle', 'selected', 'label', 'capture',
116-
'append_to_caption', 'append_to_title', 'bind', 'unbind', 'pause', 'GSprint']
116+
'append_to_caption', 'append_to_title', 'bind', 'unbind', 'pause', 'GSprint', 'choices']
117117

118118
def _encode_attr2(sendval, val, ismethods):
119119
s = ''
@@ -3573,7 +3573,8 @@ def choices(self):
35733573
return self._choices
35743574
@choices.setter
35753575
def choices(self, value):
3576-
raise AttributeError('choices cannot be modified after a menu is created')
3576+
self._choices = value
3577+
self.addattr('choices')
35773578

35783579
@property
35793580
def index(self):

0 commit comments

Comments
 (0)