Aleksandr Miroslav
2013-09-01 01:22:21 UTC
This is perhaps a silly question, local/but I didn't see how to do it
in the manual.
Given the following code:
num = 100
numbers = [str(i) for i in xrange(num) ]
numbers = "\n".join(numbers)
t = urwid.Text(numbers)
f = urwid.Filler(t)
loop = urwid.MainLoop(f)
loop.run()
If I run the above on a 80x24 terminal (that is, 80 columns, 24 lines)
and num < 24, we are good.
If num is > 24 or any size greater than the number of rows, the text
will be clipped.
Now here is the behavior I am after, I want to display the bottom half
of the text, not the top half. For the above code, this is what I see:
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
That's the top portion of text box, fitted within the contents of the
screen, but I want to display something like this:
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
What is the canonical way to do this? I understand of course that I
can calculate the number of rows and then clip the text myself. I
wanted to see if there was some parameter to Text/Fill that would do
this for me?
Thank you.
in the manual.
Given the following code:
num = 100
numbers = [str(i) for i in xrange(num) ]
numbers = "\n".join(numbers)
t = urwid.Text(numbers)
f = urwid.Filler(t)
loop = urwid.MainLoop(f)
loop.run()
If I run the above on a 80x24 terminal (that is, 80 columns, 24 lines)
and num < 24, we are good.
If num is > 24 or any size greater than the number of rows, the text
will be clipped.
Now here is the behavior I am after, I want to display the bottom half
of the text, not the top half. For the above code, this is what I see:
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
That's the top portion of text box, fitted within the contents of the
screen, but I want to display something like this:
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
What is the canonical way to do this? I understand of course that I
can calculate the number of rows and then clip the text myself. I
wanted to see if there was some parameter to Text/Fill that would do
this for me?
Thank you.