heik0
2014-05-13 09:18:02 UTC
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
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