ttkwidgets
ttkwidgets copied to clipboard
Improvement ideas for ttkwidgets
So I've been using the ttkwidgets
library for a quite a long time, and I have some improvement, and modification ideas I'd like to share here. Unfortunately(?), it got a bit long.
Improvement ideas:
FontChooser:
- Add a
master
option to the dialog, and make the chooser windowtransient
- Change the
sunken
relief tosolid
to flatten it and make it look less 90-ish - Add an
AutocompleteEntryListbox
instead of aLabel & Listbox
for improve search (like in tkFontChooser) - Change the example text to something more useful, kikeThe quick brown fox (if it fits)
ColorChooser:
- For appropriateness, change the
HTML
label toHex
- I recommend replacing the custom-styled
tk.Spinboxes
with attk.Spinbox
- Add hex tooltips to the color-preset labels
- For flatness, change the frame reliefs to
solid
- I would consider moving the 'Ok' and 'Cancel' buttons to the left side because it's much more common and handy if they are on the left
- It would be good to have a regular indicator on the alphabar, and gradientbar, sometimes it's hard to spot the black line
Calendar:
If you don't delete it:
- Create a 'Today' button
- Change the 'Previous' and 'Next' buttons to arrows, with
Toolbutton
style - I found a calendar widget here that uses many keyboard shortcuts for navigation, this can also be useful
LinkLabel:
- Change the default hover-cursor from
hand1
tohand2
, it looks native (yes, even on Linux :). Maybepointerhand
on the Mac.
ItemsCanvas:
- Change the movement cursor from
exchange
tofleur
, it looks much more "moving"
ToolTip:
I agree with @Dogeek (Merge Tooltip from tkinterpp) tooltips usually have no title, and images. Today, tooltips look like this:
GitHub:
WinUI:
So, I would change this widget, because the current one doesn't look too good, and modern.
To display title labels and images, maybe buttons, TeachingTips
are used these days, not ToolTips
Inconsistencies:
I think it’s a very good idea to collect widgets from various authors, but I think they should be standardized somehow. For example, there are very striking differences between askfont
and askcolor
, like that Askfont
doesn't support master, askcolor
do, but calls it parent
(note that Tkinter uses master
).
New widget ideas:
Here I couldn’t really decide what would fit in ttkwidgets
because I don’t know what the concept of ttkwidgets actualky is.
- To help with more complex widgets, or
- to simplify the use of Tkinter with even basic widgets like a menubar. I think this second would be better because most people use Tkinter because they need a GUI, and for that, it's better to have such basic widgets at their disposal as well.
Simple widgets:
- Switch
- ToggleButton
- AutoarrangeFrame - this is a very useful widget if you want to create a responsive gui (and usually you want)
Entries:
- On-screen keyboard for entries. Example:
- Placeholder text for entries (perhaps with a hook like
tooltips
) - Tag entry
Not sure:
- ContextMenu / PopupMenu
- Menubar
Complex widgets:
- TimePicker
- Toolbar
- Statusbar / Infobar
- RichTextbox (with formatting-toolbar, or context menu with copy, paste, and formatting)
- Custom messageboxes
This is a very good and useful package, so keep going!
It's a very long issue, so I'll drop in my thoughts as I go.
- Charts : It's not necessary to implement charts in ttkwidgets, as it's already implemented comprehensively as part of matplotlib, which is a very mature and well-regarded library.
- VideoPlayer : I thought about it, and it's impossible to do with python. At least, impossible to have decent framerates. The one you linked is my implementation, and it sucks performance wise. It's only good to display gifs at best
- ContextMenu : I don't think that's a good idea, implementing a contextual menu is already very straightforward in standard tkinter. The only thing is that it doesn't look very modern. Honestly, if you're designing GUIs with tkinter, it should be obvious that you won't get the most modern and up to date GUI lookswise
That's about it for now
Thank you both for taking the time to write up your thoughts. I agree with most of the suggestions, but my attention is currently focused elsewhere. Mostly I am studying, but when working on Tkinter-things I have been working on making Python packages out of tksvg
and tkextrafont
, in the scheme of a larger plan to make Tkinter look better than it does together with @rdbende .
Anyone is welcome to pick up any of these issues and open a PR for it, I'll be happy to review it. However, I won't have time to implement any of these things for what looks like is going to be months.
Lastly to chip in on the idea of a video player widget: Perhaps it would be possible to do this by building an implementation of a widget in C? Even writing a mock-up for that would be a lot of work though and it might still not provide the performance required to play a 30FPS video. There'd certainly have to be some reliance on an external library to decode the video in the first place, making compiling on multiple platforms quite a bit more complicated.
Thanks for the review! I started to implement some of these. I also thought that the ContextMenu might actually not be necessary, I just wrote what came to mind, and as I mentioned earlier I'm not sure that MenuBar and ContextMenu and some others are actually necessary.