问题标签 [urwid]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
python - urwid listboxes won't scroll
Pressing up or down should scroll the list but in my case it doesn't. Is there something wrong ?
EDIT 1
Code works perfectly in fact I didn't understand what scrollable lists are. I thought pressing up or down would select item in the list but it doesn't. What this does is just scroll your terminal when it doesn't have enough space to display all items at once. You must resize your terminal to a very small size to understand what this code does.
EDIT 2
To change focus when pressing up or down, a strange API has to be used. I would have loved to see an API like listbox.focus_next()
/ listbox.focus_previous()
, but you have to handle the positions yourself. Of course, you can create your own functions (or subclass ListBox) to offer a better API
EDIT 3
A better API :
python - 如果您对 API 不满意怎么办?
我正在学习urwid。
Urwid 列表框有一个不适合我的 API。例如,为了将焦点更改为下一个/上一个元素,我想写:
但是 urwid.ListBox 提供的 API 是这样的:
1)关注列表框中的前一个元素
2)关注列表框中的下一个元素
请注意,所有这些方法都不是在列表框本身上调用的,而是在其属性之一(主体)上调用的。
对这种情况不满意,我决定继承 listbox 本身,为 API 提供两个新服务(方法):focus_previous() 和 focus_next(),如下所示:
在处理令人不快的 API 时,这是(子类化)正确的方法吗?
python - 如何在 urwid 中创建嵌套列表框?
是否可以将 ListBoxes 放在 SimpleListWalkers 内?我正在尝试制作嵌套的 ListBox,但出现此错误:
AttributeError: 'MyListBox' object has no attribute 'rows'
python - python urwid.Terminal - 启用滚动
我正在尝试执行 linux 命令/shell 脚本并在基于 python urwid 的控制台中显示输出。
当我使用子进程并使用线程将输出附加到文本框小部件时:
优点:
- 它按预期显示输出运行时。
- 使用箭头键可以向上/向下滚动
问题:
- 它在输出中显示非 ascii 字符 - 用于清除屏幕或颜色等。
使用 urwid 终端时:
优点:
- 它按预期显示输出运行时。
- 输出文本整洁 - 没有显示奇怪的字符 - 在输出文本中可以很好地看到颜色。
问题:
- 显示输出时超出屏幕限制时无法向上滚动。
- 使用“cmd | less”执行命令可以启用滚动,但非 ascii 字符再次显示在那里,这是不希望的。
有什么方法可以让我们在 urwid.Terminal 小部件中使用向上/向下箭头键进行滚动?请帮忙。
python - Python urwid 模块 - AttributeError: 'NoneType' 对象没有属性 'render
我是 urwid 在 Python 中的控制台小部件的新手,并正在尝试学习它。为了进行实验,我正在尝试制作一个屏幕,其中标题“Foobar”位于顶部,底部我将在左列中有 2 个图表(我相信这将被称为主体)。
到目前为止,我试过这个:
但我卡住了我得到的地方:
有谁知道为什么?
python - 如何从“更改”信号处理程序更改 urwid.Edit 的文本?
我想从其“更改”信号处理程序中更改 urwid.Edit 的文本。但是,它什么也没做。最小的工作示例:
如果按回车,它实际上会调用 .set_edit_text(),但文本保持不变。我如何实现我想要的?
python - Python + Urwid:列列表框?
在我的应用程序中,我有一个 ListBox 包含很长的短项目列表。我想在每页上展示尽可能多的项目,我希望 ListBox 显示不止一列。
我查看了文档,没有找到任何描述 ListBox 和 Columns 容器组合的内容。那有可能吗?还是我走错路了?
python - Urwid ProgessBar 没有正确更新
我正在玩 urwid 库,到目前为止它非常棒。但我无法让进度条工作。我写了一个这样的简单测试程序:
如果我启动它,进度条应该是 0%。然后我按下按钮,几秒钟后进度条显示 100%。但我错过了 0% 到 100% 之间的步骤。他们只是不会出现。
渲染函数的额外调用也不起作用。
我也尝试过这样的事情:
这很好用。似乎进度条对在循环中被调用并不满意。好像很奇怪?!有人有任何想法来解决这个问题吗?
提前致谢 :)
PS:INFO:urwid 1.2.0 在 python 2.6.6、2.7、3.3 上测试都一样
python - 我无法找到工作
我无法获得 urwid “hello world” 示例工作。我尝试使用 urwid 1.1.1、1.2.1,使用 python 2.7.6、3.4.0,通过 pip 安装,在全新安装 ubuntu 13.10、14.04 上,我仍然有这个输出错误:
运行的代码:
python - Urwid、autobahn 和扭曲的事件循环集成
我正在使用高速公路连接到服务器并获取"push"
通知,并且我想使用他们的扭曲事件循环制作一个简单的 urwid 界面。但是我不确定从我的高速公路处理程序类中设置 urwid 文本的最佳方法是什么。在下面的代码中,您可以看到我想从我的类中调用该"updateText"
方法的当前实现。"MyFrontendComponent"
这样做的最佳方法是什么?
和服务器代码:
谢谢!