Conversation
RedFantom
left a comment
There was a problem hiding this comment.
In the current state, to me the widget feels unfinished. Then again, when I wanted to create a widget with similar functionality, it was intended to be pretty huge from the outset, so perhaps that is not what this widget is intended for in the first place.
There are some things I think must be addressed, but particularly the comments about functionality are kind of open. Just things to consider, not necessarily required, as they depend on what you want the widget to be able to do. I do think a catch-all is necessary, though.
| from collections import defaultdict | ||
|
|
||
|
|
||
| class Shell(tk.Canvas): |
There was a problem hiding this comment.
Quite some time ago I started implementing a similar widget on the Console branch. Personally, I would add quite some features, including pressing up and down to cycle through command history, using the tab to have some form of completion...
The textvariable is modifiable by the creator of the widget, which inherently allows the creator to implement all these things. It is, however, not easy to do things with \b or other special characters. Perhaps it is worth considering to implement these things in the base widget.
| return | ||
|
|
||
| def on_configure(self, event): | ||
| padding = 4 |
There was a problem hiding this comment.
On Ubuntu 20.04, GNOME, Python 3.8.2, a padding value of 4 makes the widget disappear until manually resized. A padding size of 2 solves this issue. I understand that this is here for stretching the widget to the size of its master, but, speaking from personal experience, this introduces head-aches like this when working with Canvases.
This code should be tested on different platforms in order to make sure that the widget does not resize itself out of visibility.
There was a problem hiding this comment.
On windows, a padding of 2 makes the widget grow indefinitely
| self.text_update() | ||
|
|
||
|
|
||
| if __name__ == '__main__': |
There was a problem hiding this comment.
The example has been moved to a separate file so may be removed here.
For new widgets only:
PR Details:
Description
A terminal-like shell widget
Checklist
/examples/testsAUTHORS.md