Closed SkiHatDuckie closed 2 years ago
Can you provide the output of os.platform
? The recent release should have fixed this, but I guess the detection isn't perfect :(.
Output: Windows-10-10.0.19043-SP0
I'll try and mess around with the Terminal class to see if I can do anything. It definitely is catching the error, but it's not doing anything except for raising an exception.
Sorry, just realized I mean os.name
instead of platform. Been a long day.
I suspect it isn't getting nt
, which is what it expects. It was implemented by a collaborator on Windows, and it worked for both them and me when I tried to run it locally, so not sure why your machine is different.
But hey, that's just the beauty of Windows compatibility! You never know what you get.
Just updated pytermgui to 4.3.2, and window now successfully renders! I'll report any other issues I find as I use the library.
Happy to hear that!
Describe the bug I was trying out one of the examples in the documentation, but it kept throwing an exception complaining about there being no method called
truncate
. I started to follow the traceback and found out that it was callingsys.stdout.truncate(0)
... which doesn't exist (at least on windows it doesn't).To Reproduce Steps to reproduce the behavior:
if name == "main": with ptg.WindowManager() as manager: window = ptg.Window( "[wm-title]My first window!", "", ["Exit", lambda *_: manager.exit()], )
Exception in thread WM_DisplayLoop: Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64qbz5n2kfra8p0\lib\threading.py", line 932, in _bootstrap_inner self.run() File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64qbz5n2kfra8p0\lib\threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "c:\Users\Conno\pyvenv\lib\site-packages\pytermgui\window_manager.py", line 447, in _loop animator.step() File "c:\Users\Conno\pyvenv\lib\site-packages\pytermgui\animations.py", line 120, in step if animation.step(): File "c:\Users\Conno\pyvenv\lib\site-packages\pytermgui\animations.py", line 69, in step step_callback(self.target) File "c:\Users\Conno\pyvenv\lib\site-packages\pytermgui\window_manager.py", line 998, in _on_step ret_val = step_callback(_target) File "c:\Users\Conno\pyvenv\lib\site-packages\pytermgui\window_manager.py", line 646, in _on_step self.nullify_cache(window) File "c:\Users\Conno\pyvenv\lib\site-packages\pytermgui\window_manager.py", line 478, in nullify_cache self.redraw() File "c:\Users\Conno\pyvenv\lib\site-packages\pytermgui\window_manager.py", line 977, in redraw terminal.write("\x1b[2J") File "c:\Users\Conno\pyvenv\lib\site-packages\pytermgui\animations.py", line 69, in step step_callback(self.target) File "c:\Users\Conno\pyvenv\lib\site-packages\pytermgui\window_manager.py", line 998, in _on_step ret_val = step_callback(_target) File "c:\Users\Conno\pyvenv\lib\site-packages\pytermgui\window_manager.py", line 646, in _on_step self.nullify_cache(window) File "c:\Users\Conno\pyvenv\lib\site-packages\pytermgui\window_manager.py", line 478, in nullify_cache self.redraw() File "c:\Users\Conno\pyvenv\lib\site-packages\pytermgui\window_manager.py", line 977, in redraw terminal.write("\x1b[2J") File "c:\Users\Conno\pyvenv\lib\site-packages\pytermgui\terminal.py", line 390, in write self.clear_stream() File "c:\Users\Conno\pyvenv\lib\site-packages\pytermgui\terminal.py", line 412, in clear_stream self._stream.truncate(0) io.UnsupportedOperation: truncate
fatal: not a git repository (or any of the parent directories): .git PyTermGUI v4.3.1
Python: 3.8.10
Platform: Windows-10-10.0.19043-SP0