我试图用asciimatics制作一个简单的商店应用程序模块。It应该是一个应用程序,你可以浏览产品,比如在商店,然后你可以添加或删除你的购物车项目。我使用他们的联系人列表示例应用程序作为指南,但是当我编写代码时,我被这个错误卡住了
kumecky@osmijanko:~/notebooks$ python3 form.py
Traceback (most recent call last):
File "form.py", line 103, in <module>
Screen.wrapper(demo, catch_interrupt=True, arguments=[last_scene])
File "/usr/local/lib/python3.5/dist-packages/asciimatics/screen.py", line 1167, in wrapper
func(screen, *arguments)
File "form.py", line 97, in demo
screen.play(scenes, stop_on_resize=True)
File "/usr/local/lib/python3.5/dist-packages/asciimatics/screen.py", line 1343, in play
scenes, unhandled_input=unhandled_input, start_scene=start_scene)
File "/usr/local/lib/python3.5/dist-packages/asciimatics/screen.py", line 1406, in set_scenes
old_scene=start_scene, screen=self)
File "/usr/local/lib/python3.5/dist-packages/asciimatics/scene.py", line 44, in reset
effect.reset()
File "/usr/local/lib/python3.5/dist-packages/asciimatics/widgets.py", line 552, in reset
self.data = deepcopy(self._initial_data)
File "/usr/local/lib/python3.5/dist-packages/asciimatics/widgets.py", line 475, in data
layout.update_widgets()
File "/usr/local/lib/python3.5/dist-packages/asciimatics/widgets.py", line 1162, in update_widgets
widget.value = widget.value
File "/usr/local/lib/python3.5/dist-packages/asciimatics/widgets.py", line 2224, in value
for i, [_, value] in enumerate(self._options):
ValueError: too many values to unpack (expected 2)
这是我的代码-ShopDB类只是保存数据库对象,Shop类与ascimatics模块本身一起工作。在
^{pr2}$
枚举后,
self._options
似乎有两个以上的值。这就是为什么不能在代码中将这些值赋给[_, value]
。 例如:这段代码给出了一个错误,因为Python试图将}匹配,但这无法完成。
如果您真的想这样做,并且不必担心}到底是什么,只需使用
^{pr2}$[1,2,3]
与{j
和{*
运算符,然后:输出:
^{3}$相关问题 更多 >
编程相关推荐