Comments (7)
@rndUser I think we need to add the hash method to AttrSpec for that to work. It certainly works with palettes:
from urwid import MainLoop, Edit, AttrMap, Columns, ListBox, SimpleListWalker
loop = MainLoop(
widget=ListBox(SimpleListWalker([
AttrMap(
Columns([
AttrMap(Edit('one'), 'col1'),
AttrMap(Edit('two'), 'col2')]),
None,
focus_map={'col1': 'focus1', 'col2': 'focus2'}),
AttrMap(
Columns([
AttrMap(Edit('three'), 'col1'),
AttrMap(Edit('four'), 'col2')]),
None,
focus_map={'col1': 'focus1', 'col2': 'focus2'})])),
palette=[
('col1', 'dark green', 'light gray'),
('col2', 'dark blue', 'light gray'),
('focus1', 'light green', 'dark blue'),
('focus2', 'light blue', 'dark blue')])
loop.run()
from urwid.
@rndusr if you would like the whole Columns to be visibly in focus put an AttrMap around the Columns instead of inside it.
Closing this issue for now, please feel free to reopen if this doesn't solve your problem.
from urwid.
I want different colors for each widget in the Columns, so wrapping the whole Columns in an AttrMap doesn't work.
from urwid.
I can't figure out how to reopen this issue. Am I too dumb or simply not allowed?
from urwid.
You can have AttrMap around the Columns and inside each item too. The AttrMap outside just needs to have a focus_map passed as a dict so it can modify attributes already set by the widgets inside.
from urwid.
Ok, I don't quite understand how this might work right now, but I'm gonna bang my head against the manual a bit more. Thanks for your quick help!
But I have one more question: I'm currently passing AttrSpecs to AttrMap like this:
AttrMap(somewidget, AttrSpec('brown', 'black'), AttrSpec('yellow', 'dark gray'))
Can I keep doing this when I pass dicts to AttrMap or will I have to use a palette? Or, to ask in another way: Can I use AttrSpecs as key and value in the dict I'm passing as focus_map?
from urwid.
I guess I'll have to do some rewriting then.
Thanks again for your help. It's very much appreciated.
from urwid.
Related Issues (20)
- Release 2.4.3 breaks rendering [BUG] HOT 3
- Weird rendering bug on Windows only HOT 11
- [ANNOUNCE] The `Urwid` currently packaged and available via `MSYS2` distro HOT 1
- Last-row insertion does not work on Windows HOT 4
- Dropping str_util.c HOT 2
- [BUG] Urwid 2.5.3 causes the Urwidgets TextEmbed widget to crash HOT 5
- Remove .DS_Store
- [BUG] `Text.render()` raises `CanvasError` for some non-UTF-8 encodings when `1 <= maxcols < 3`
- [BUG] urwid.widget.pile.PileError: added content invalid: [(<SignalWrap selectable box widget>,(<WHSettings.WEIGHT: 'weight'>, 0.5))] HOT 2
- [BUG?] unsupported operand type(s) for +: 'ParentNode' and 'int' HOT 1
- [BUG] 2.4.2 introduced regression (or maybe the original code was wrong all along) HOT 10
- [BUG] Too many items in ListBox with ScrollBar tanks performance HOT 1
- [BUG] `MainLoop.watch_pipe` is closed after the first callback HOT 4
- [BUG] urwid.Overlay valign doesn't accept `relative` any more HOT 2
- [Question] how to update interface but not Block interface? HOT 5
- [BUG] Not receiving 'shift mouse press' events HOT 7
- [BUG] Type hints for Widget `row()` method are inconsistent with usage
- [BUG] ListBox wrapped in AttrMap is not scrollable with ScrollBar HOT 1
- [Question]how can i input Chinese encoding into the Edit widget? HOT 3
- How to scroll two listboxes together? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from urwid.