ceccopierangiolieugenio / pyTermTk

Python Terminal Toolkit - a Spiced Up Cross Compatible TUI Library 🌶️
https://ceccopierangiolieugenio.github.io/pyTermTk-Docs/
MIT License
598 stars 23 forks source link

'TTkTerminalView' object has no attribute '_inout' #171

Closed ecliipt closed 1 year ago

ecliipt commented 1 year ago

I've been looking for a terminal for my project using pytermtk and I found a TTkTerminal in https://github.com/ceccopierangiolieugenio/pyTermTk/tree/TTkTerminal and it gives me this error. I'm still learning how to use pytermtk so sorry if i'm missing smt. (i'm trying to make a tab with a terminal) here's the full traceback of the error: """ raceback (most recent call last): File "/home/user/pyTermTk/demo/demo.py", line 356, in main() File "/home/user/pyTermTk/demo/demo.py", line 353, in main root.mainloop() File "/home/user/pyTermTk/demo/../TermTk/TTkCore/ttk.py", line 194, in mainloop self._mainLoop() File "/home/user/pyTermTk/demo/../TermTk/TTkCore/ttk.py", line 204, in _mainLoop self._input.start() File "/home/user/pyTermTk/demo/../TermTk/TTkCore/TTkTerm/input.py", line 77, in start self.key_process(stdinRead) File "/home/user/pyTermTk/demo/../TermTk/TTkCore/TTkTerm/input.py", line 161, in key_process self.inputEvent.emit(kevt, mevt) File "/home/user/pyTermTk/demo/../TermTk/TTkCore/signal.py", line 140, in emit slot(*args[sl], **kwargs) File "/home/user/pyTermTk/demo/../TermTk/TTkCore/ttk.py", line 210, in _processInput self._key_event(kevt) File "/home/user/pyTermTk/demo/../TermTk/TTkCore/ttk.py", line 271, in _key_event keyHandled = focusWidget.keyEvent(kevt) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/user/pyTermTk/demo/../TermTk/TTkWidgets/TTkTerminal/terminalview.py", line 792, in keyEvent self._inout.write(evt.code.encode()) ^^^^^^^^^^^ AttributeError: 'TTkTerminalView' object has no attribute '_inout' """ I'm using wsl on a win11 Thx!

ceccopierangiolieugenio commented 1 year ago

The terminal is still in a very early prototype, I am slowly trying to fix the bugs, implement all the ansi codes and make it kind of feature complete.

Are you able to share your code?

This is a very basic example you can use as reference;

import TermTk as ttk

root = ttk.TTk(layout=ttk.TTkGridLayout(), mouseTrack=True)

tab = ttk.TTkTabWidget(parent=root)

terminal = ttk.TTkTerminal()

tab.addTab(terminal, "Terminal")

terminal.runShell()

root.mainloop()

i am planning to implement also a proper select feature (to mimic the behaviour of a normal terminal emulator) to allow a proper copy and paste (as it happen in the text editor)

please let me know if you think of other useful features or if you hit some other bugs.

ceccopierangiolieugenio commented 1 year ago

I pushed a bugfix and few examples in the latest TTkTerminal branch:

https://github.com/ceccopierangiolieugenio/pyTermTk/tree/TTkTerminal/tutorial/examples/TTkTerminal

https://github.com/ceccopierangiolieugenio/pyTermTk/assets/8876552/c94b37d4-5748-485f-85bb-0414a1143f8c