[Urwid] How to use hlines in a BarGraph?

heik0 heik0 at xs4all.nl
Tue May 13 06:45:06 EDT 2014


This is now filed as bug report on github. Please refer to [1] for 
further discussion (if any) instead of this mail list.

Regards, Heiko

[1] https://github.com/wardi/urwid/issues/66


heik0 schreef op 2014-05-13 11:18:
> Hi,
> 
> Trying to use hlines in a BarGraph, I get this error everytime I try to
> have more than one line: urwid.widget.WidgetError: Widget <BarGraph box
> widget> rendered (116 x 95) canvas when passed size (116, 75)!
> 
> It boils down to this:
> 
> #########################
> import urwid
> 
> palette = [
>      ('normal', 'dark blue', 'dark gray'),
>      ('inverse', 'dark gray', 'dark blue'),
> ]
> 
> def main():
>      graph = urwid.BarGraph(
>          ['normal', 'inverse'],
>          ['normal', 'inverse'],
>          { (1,0): 'normal', },
>      )
>      bardata = [(1,), (2,), (4,), (8,), (16,), (32,)]
>      lines = [10]
>      graph.set_data(bardata, 40, lines)
>      loop = urwid.MainLoop(graph, palette)
>      loop.run()
> 
> if __name__ == "__main__":
>      main = main()
> #########################
> 
> This works and it shows a line, but when I try to add more lines, e.g.:
>    lines = [10, 20]
> or:
>    lines = [1,2,5,10]
> the WidgetError mentioned above is raised.
> 
> Am I using hlines the wrong way? I tried "random" other ways and also
> tried to figure things out in the source of speedometer, because it
> seems to work there. But I'm new to urwid and wasn't able to get my 
> head
> around how speedometer's code uses the bargraphs and hlines in
> particular.
> 
> I am using python 3.4 with urwid 1.2.1 in a virtualenv, but before
> sending this e-mail I also reproduced it on python 2.7.5 with urwid
> 1.1.1 as shipped by ubuntu 13.10.
> 
> Thanks in advance for any help. Regards,
> 
> Heiko
> 
> 
> _______________________________________________
> Urwid mailing list
> Urwid at lists.excess.org
> http://lists.excess.org/mailman/listinfo/urwid



More information about the Urwid mailing list