[Urwid] Re: newbie looks for more examples

Fabian Braennstroem f.braennstroem at gmx.de
Mon Aug 28 16:05:14 EDT 2006


Hi Ian,

* Ian Ward <ian at excess.org> wrote:
> Fabian Braennstroem wrote:
>>   File "/home/fab/Desktop/lfm/actions.py", line 189, in do
>>     exec(act)
>>   File "<string>", line 1, in ?
>> AttributeError: DialogDisplay instance has no __call__ method
>> 
>> Right now, I have no clue, what the last line means. Maybe, it is a simple
>> python/urwid problem and you do not have to know the whole lfm code to give
> > some tips!? Would be nice to use urwid for it.
>
> Well, this error suggests that lfm is trying to use the result of the 
> exec statement as a function and call it.  Perhaps the "act" string is 
> modified from what was in the dictionary -- you can get really strange 
> behaviours from code that does tricks with exec statements.
>
> But a larger issue is that Urwid wasn't designed to be integrated 
> peicemeal into curses applications. It was designed to wrap curses.
>
> One problem you'll run into is that Urwid sets up the curses palette and 
> remembers the colour pair indexes.  In an existing curses application it 
> will have already set up the palette on its own, so it will take some 
> maneuvering to make colours work properly in Urwid. If you'd like to try 
> it, read the curses_display module source code to see how it stores the 
> attribute to colour pair mapping, and fill that data structure yourself.
>
> It might not be the best project for introducing yourself to Python 
> programming, but it is possible.
>
> Now, doing a complete Urwid version of lfm would be fun.  But I'm sure 
> my idea of fun differs from most peoples' :-)

Thanks for your help! One major drawback of lfm/curses is
the speed: it is pretty slow, when there are a lot of files
in a directory. urwid seems to be much faster, at least the
browser example looks like that... so it would be a nice
project for the urwid package, but my time and knowledge is
limited :-(

Greetings!
 Fabian





More information about the Urwid mailing list