Browse Source

terminal width

Thomas Buck 8 months 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

@@ -0,0 +1 @@
1
+venv

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

@@ -1,6 +1,7 @@
1 1
 #!/usr/bin/env python
2 2
 
3 3
 import sys
4
+import os
4 5
 import asyncio
5 6
 from poll import (
6 7
     ble_conn,
@@ -10,7 +11,7 @@ from poll import (
10 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 16
 def print_bar(value, start, end, unit):
16 17
     width = terminal_width

Loading…
Cancel
Save