Browse Source

terminal width

Thomas Buck 1 year ago
parent
commit
909b69efc1
2 changed files with 3 additions and 1 deletions
  1. 1
    0
      python-test/.gitignore
  2. 2
    1
      python-test/flow.py

+ 1
- 0
python-test/.gitignore View File

1
+venv

+ 2
- 1
python-test/flow.py View File

1
 #!/usr/bin/env python
1
 #!/usr/bin/env python
2
 
2
 
3
 import sys
3
 import sys
4
+import os
4
 import asyncio
5
 import asyncio
5
 from poll import (
6
 from poll import (
6
     ble_conn,
7
     ble_conn,
10
     get_state, set_state
11
     get_state, set_state
11
 )
12
 )
12
 
13
 
13
-terminal_width = 80 + 20 # TODO detect?
14
+terminal_width = os.get_terminal_size().columns - 15
14
 
15
 
15
 def print_bar(value, start, end, unit):
16
 def print_bar(value, start, end, unit):
16
     width = terminal_width
17
     width = terminal_width

Loading…
Cancel
Save