Thank you for investigation, Ian! It's interesting ;)

There is another thing about mouse events in example (2), the MainLoop 
approach:

When I want to resize the screen, i.e. drag and drop an edge of my 
terminal window with the mouse, the screen is not redrawn automatically. 
It freezes. When I then click into the terminal or press any key, the 
screen gets resized and shows changes again. I tried to debug this 
myself, but I did not get it.. still do not understand things (like the 
alarm system) in main_loop.py :-) Or perhaps I have to add some code to 
my main module?

If I wouldn't know that it could work better (example (1)), then I 
wouldn't care. But I think that this could get fixed easily.

Jan-Philip

Jan-Philip Gehrcke wrote:
> Hello list,
>
> while Ian says that a "ListBox doesn't have code to scroll on mouse 
> wheel events", I noticed that it works accidentally, but only with my 
> self-written main loop, not with the new urwid.MainLoop() from the 
> development version. Due to a lack of time, I did not reduce my 
> working examples to the absolutely necessary to reproduce the issue 
> (feature!), but the examples are short anyway :-)
>
> 1) It scrolls!
> ==============
> The following piece of code starts a self-written urwid main loop in 
> the main thread, while another thread writes 100 lines of stuff into a 
> file. Within urwid's main loop this file is polled and the content is 
> displayed as new urwid.Text()'s in the ListBox. The overall amout of 
> items in the ListBox is limited to 50:
>
> http://paste.pocoo.org/show/nrbHdItPOpyzAApYfLpQ/
>
> Okay, after you've started the script, you will soon have reached the 
> final state: a ListBox, populated with 50 items. When I then use my 
> mousewheel, it scrolls the ListBox; it works like a charm. Is this 
> true on your machines, too? I've tested it on Ubuntu 9.04 with 
> "terminal" and "konsole", with "raw_diplay" and "curses_display" and 
> with urwid 0.9.8.4 and the latest hg tip: it just works :-)
>
> 2) It doesn't :(
> ================
> I've another example code that populates the ListBox, but this time 
> with an os.pipe() (that's not interesting for now). The main 
> difference is, that I used urwid.MainLoop() here:
>
> http://paste.pocoo.org/show/ZoEpBjDJ8ZZDwp0DMCMX/
>
> Run it, see your ListBox getting populated with items and use your 
> mouse wheel after the final state is reached: does it do anything? Not 
> for me. The feature is gone :-)
>
> I'm interested in the reasons for this phenomenon! And I think that 
> official and always-working mousewheel support would be great in general!
>
> Greetings,
>
> Jan-Philip Gehrcke
>



_______________________________________________
Urwid mailing list
[email protected]
http://lists.excess.org/mailman/listinfo/urwid

Reply via email to