Git Product home page Git Product logo

Comments (7)

wardi avatar wardi commented on June 28, 2024 1

@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.

wardi avatar wardi commented on June 28, 2024

@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.

rndusr avatar rndusr commented on June 28, 2024

I want different colors for each widget in the Columns, so wrapping the whole Columns in an AttrMap doesn't work.

from urwid.

rndusr avatar rndusr commented on June 28, 2024

I can't figure out how to reopen this issue. Am I too dumb or simply not allowed?

from urwid.

wardi avatar wardi commented on June 28, 2024

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.

rndusr avatar rndusr commented on June 28, 2024

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.

rndusr avatar rndusr commented on June 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.