Is tkinter destined to be replaced someday?

I honestly really like tkinter, it’s simple and not tied down to a desktop environment like GTK and (to a degree) Qt is. Plus it’s pretty lightweight.

But is the writing on the wall? Is tkinter not going to last forever? Since tcl/tk has incredibly slow development, I worry it won’t be usable in the future.

Just asking for a bit reassurance I have nothing to worry about.

1 Like

It will not go anywhere until an alternative GUI library has been in the python standard library for a long time, at least 10 years.

Since there aren’t even plans to do anything close to adding a new GUI library, tkinter will stay for at least another 15 years, and most likely “forever”, i.e. as long as python stays relevant.

2 Likes

I use Qt because it is not tied down.
I use it for portable code that runs on macOS, Windows and linux desktops.

1 Like

Perhaps Qt might not be tied down to KDE like GTK is for GNOME, but I still prefer not having to learn an entire ecosystem like I have from experience (and some frustration) with Qt5/Qt6 python bindings.

what about wxPython :slightly_smiling_face:

Too many show stopper bugs in the past made me migrate from wxPython to PyQt.

I managed to migrate in a few man days of effort for my too big projects. The resulting Qt code was far cleaner.
The wxPython code required a lot of OS specific logic that was unnecessary with Qt.

but only in wxlib not in the genuine wx part, I could imagine :woozy_face:

It’s easy to fall victim to analysis paralysis when these sorts of subjects come up. Personally I’d advise you to write your tool in what your productive in and deal with the change down the line if it ever happens (mostly it never does).

Generally speaking there are some tactics you can use to help you deal with issues like a change of UI framework though

Separation of concerns

If you keep your business logic out of your UI then it becomes far easier to transition to a different UI framework. You may still need to re-write some parts where framework specific types were used but it’ll be manageable.

I would take a look at the MVC pattern, and the Observer Pattern.

Learn the fundamentals

Most user interface frameworks are an event loop, with some widgets and a mechanism for broadcasting changes (callbacks, or some form of the observer pattern). If your comfortable with these topics you’ll be able to pickup a new framework fairly easily.

What I’ve learned over the years is that if you learn fundamental skills and concepts you’ll be able to make switches to new technologies without too much pain.

3 Likes

I do not know what you mean by this.
The bugs I encounted where in the C++ code.

Well stated. :ok_hand: :smiley:

Slow* but not dead. The maintainers finally, a couple on months ago, released tcl/tk 9.0. It removes some deprecated features, makes other changes, and most importantly from my viewpoint, supports all unicode characters, not just the original Basic Multilingual Plane (first 64K) subset. Once we release Python with 9.0, I, as a maintainer of tkinter-based IDLE, will feel better about tk than I have for a decade.

  • tcl/tk devs have been kept busy updating the macOS ports to run on the new versions released each year. (As have Python macOS devs.) Apple is much freer about breaking 3rd-party software than Linux or Windows, both of which require much less maintenance. *nix X11 and Windows graphics are much more stable that macOS graphics.