为什么 Tk GUI 被认为丑陋?

发布于 2024-07-09 18:30:29 字数 1449 浏览 4 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

少年亿悲伤 2024-07-16 18:30:29

我认为部分原因是 Tk 非常强大且易于使用,但它没有太多的手持功能。 由于它非常简单,因此 UI 设计经验很少的人也可以在很短的时间内上手。 但是,如果没有丰富的经验,他们就会依赖默认值和最短路径解决方案(阅读:不需要时不要花时间隐藏滚动条,不要使用工具栏的常见习惯用法,不要正确对齐小部件等)。

不幸的是,Tk 的默认设置并不总是最漂亮的。 正如问题中的屏幕截图所示,默认使用相对较厚的边框宽度和次优字体,并且复选框确实直接来自 80 年代。 然而,在专家的手中,所有这些问题都是小问题,可以在闲暇时解决。

例如,经过五分钟的调整,原始屏幕截图可能如下所示:

稍微改进了 ui

当然,这看起来仍然有点笨重,但可以说它比原来的要好很多。 如果用一个小时来完成这项任务,还可以做出更多改进。

tk 8.5(实际上是几年前)提供了对主题和本机小部件的支持,甚至 X11 版本也进行了小幅改进。 不过,Tk 在视觉效果方面仍然落后于潮流,如果设计需要渐变、动画等,就迫使人们“自己动手”。

然而,对于大多数类型的应用程序来说,Tcl 和 Tk 仍然是一个很好的实用解决方案。 如果您尝试与 Flash 应用程序竞争,您就会失败。 但是,如果您有一个工业应用程序,只需要运行、可用,或许还需要跨平台,那么 Tk 仍然是最好的选择之一。


截至 2015 年,有一篇关于 Tkinter 的 IDLE IDE 现代化的精彩文章。 本文介绍了使 IDLE 看起来更现代的一些步骤:

I think part of the reason is that Tk is surprisingly powerful and easy to use but it doesn't do much hand-holding. Since it is so easy, people with little experience in UI design can get something to work in very short order. But, without a lot of experience they rely on defaults and shortest-path-to-a-solution (read: don't take time to hide scrollbars when they aren't needed, don't use common idioms for toolbars, don't properly align widgets, etc).

Unfortunately, Tk's defaults aren't always the prettiest. As the screenshot in the question shows, the default uses relatively thick border widths and suboptimal fonts, and the checkboxes are indeed straight out of the 80's. In the hands of an expert, though, all these problems are minor issues that can be take care of in idle moments.

For example, with five minutes of tweaking, the original screenshot can look like this:

slightly improved ui

Certainly that's still a bit clunky looking, but arguably it's better than the original by a considerable bit. With an hour dedicated to the task, several more improvements could be made.

With tk 8.5 (and actually for a couple years prior) there is support for themes and for native widgets, and even the X11 version gets a minor facelift. Tk is still behind the curve in eye candy though, forcing one to "roll their own" if the design calls for gradients, animations and so forth.

Tcl and Tk, however, remain a good pragmatic solution for most types of applications. If you're trying to compete with a flash application you'll lose. But if you have an industrial application that just needs to work and be usable and perhaps multi-platform, Tk is still one of the best choices out there.


As of 2015, there's a nice write-up about modernizing Tkinter's IDLE IDE. The article describes some of the steps taken to make IDLE more modern looking:

北凤男飞 2024-07-16 18:30:29

事实上,“只是不同”的论点是我的主要原因。 Tk GUI 的外观和行为与本机应用程序不同,这会在多个小方面影响“外观和感觉”,这使得复杂的应用程序与给定系统上的本机应用程序相比感觉怪异和笨重。

文件对话框可能是我所写内容的一个完美示例:它们可能并不比某些系统上的本机对话框“更差”或“更好”,但它们是不同的,它们的行为与系统上的所有其他应用程序不同。

如果您是 MacOS X 用户,您可以通过将本机 Mac 应用程序与在具有 X11 兼容层的 Mac 上运行的应用程序(例如 Gimp 或 Inkscape)进行比较来感受一下。 它们的行为与所有其他应用程序不同(顶部栏没有菜单,cmd+tab 的工作方式有点不同,cmd+backtick 的工作方式有很大不同),因此,虽然它们的行为在 Linux X11 桌面上很好,但相同的行为在 Linux X11 桌面上感觉很奇怪和笨重。苹果。

Tk 的缺点是这些 GUI 实际上并不是任何地方都原生的。

对于便携式 UI,我可能会推荐 wxWidgets,它只是一个通用 API 层(外观),适用于您的系统提供的任何本机 UI。 对于您目前的情况来说,这可能有点离题,但无论如何它可能值得一看。

The "it's just different" argument is, in fact, the main reason for me. Tk GUIs don't look and behave like a native application, which affects the "look & feel" in multiple small ways, which make a complex app feel weird and clunky compared to native apps on given system.

File dialogs may be a perfect example of what I am writing about: they may not be "worse" or "better" than native dialogs on some system, but they are DIFFERENT, they behave differently to all the rest of applications on the system.

If you're MacOS X user, you may get a feel of it by comparing native Mac apps with apps running on Mac with X11 compatibility layer (like Gimp or Inkscape). They behave differently to all other apps (no menu at top bar, cmd+tab works a bit differently, cmd+backtick works much differently), so - while their behaviour is fine on Linux X11 desktop - the same behaviour feels weird and clunky on Mac.

Downside of Tk is that these GUIs aren't actually native anywhere.

For a portable UI, I may recommend wxWidgets, which are just a common API layer (a facade) for whatever native UI your system provides. It may be a bit offtopic for your current situation, but it may be worth looking at anyway.

鸠书 2024-07-16 18:30:29

TK 对本机外观 GUI 的支持比以前好得多。 Tk 的早期版本具有类似主题的外观和感觉,旨在与基于主题的桌面环境(例如 MWM 和 CDE)一起使用。 在这种环境中,它看起来就像一个本机应用程序。 长期以来,Motif 被用作 X11 应用程序的默认 GUI 工具包。 GTK 和(在某种程度上)QT 的出现意味着许多此类应用程序的实际情况已不再如此。

大多数现代跨平台 GUI 工具包 - GTK、QT Tk、WXWidgets 等 - 现在都有一些使用底层本机小部件的机制。 WX 从一开始就是为了做到这一点而设计的 - X11 上的 GTK 和 Motif 版本、Windows 上的 Win32 以及 (IIRC) OSX 版本。 GTK 有一个主题引擎并使用基于本机小部件的主题。 QT 模拟外观和感觉,Tk 有一个原生工具包的包装器。

具有本机外观和风格的 TK 应用程序示例:

  1. SnackAmp(Vista 上的 Win32)

SnackAmp Tk GUI on Windows Vista

  1. Linux 上的 PostgreSQL 访问

原生 Tk API

TK has considerably better support for native look-and-feel GUI's than it used to. Earlier versions of Tk had a motif-ish look and feel, which was intended to be used with motif-based desktop environments such as MWM and CDE. In this environment it looked like a native application. For a long time, Motif was used as a default GUI toolkit for X11 apps. The advent of GTK and (to some extent) QT means that this is no longer really the case for many such applications.

Most modern cross-platform GUI toolkits - GTK, QT Tk, WXWidgets and others - have some mechanism to use the underlying native widgets now. WX was designed to do this from the beginning - GTK and Motif versions on X11, Win32 on Windows and (IIRC) an OSX version. GTK has a theming engine and uses themes based on native widgets. QT emulates the look and feel and Tk has a wrapper for the native toolkit.

Examples of TK apps with native look and feel:

  1. SnackAmp (Win32 on Vista)

SnackAmp Tk GUI on Windows Vista

  1. PostgreSQL Access on Linux

Native looking Tk API

埖埖迣鎅 2024-07-16 18:30:29

因为它的外观是由程序员设计的,他们既不是用户体验设计师也不是图形设计师。 也许它解决了问题(在多个平台上具有相同的 UI),但它看起来很难看。

添加:
实际上,让 UI 达到不被认为丑陋的程度是一门艺术。 我的团队中有两个极端。 一个人并不关心用户界面:他看到一个按钮,无论它在屏幕上如何绘制,它都是一个按钮; 即使你把它画成“让我大吃一惊”的柠檬绿,在亮红色的背景上,他仍然会认为它是一个按钮,因为它“像按钮一样嘎嘎作响”。 另一位团队成员致力于让 UI 变得“酷”。 但他完全忽略了这一点:让 Office 2007 成为“Office 2007”的不仅仅是闪亮的外观,还有图标、控件之间的一致性以及与它们交互的方式 — 所有这些将外观与感觉融为一体的小细节。 结果? 给猪涂口红。

Because its look-n-feel was designed by people who are neither UX nor graphics designers, but programmers. Maybe it solves the problem (having same UI across a number of platforms), but it looks ugly.

Added:
Actually, getting UI to the point where it's not considered ugly is an art. I have two extremes in my team. One guy just doesn't care about UI: he sees a button and it's a button no matter how it's drawn on the screen; even if you paint it "pop my eyes" lime green on a bright red background he'll still consider it a button, because it "quacks as a button". The other team member is all about making UI "cool". But he completely misses the point that it's not just shiny look makes Office 2007 "The Office 2007", but it's also icons, consistency across the controls, the way you interact with them -- all these little details that solder look with feel. The result? A lipstick on a pig.

单挑你×的.吻 2024-07-16 18:30:29

仅举一个例子:如果您查看您提供的示例,您会看到很多额外的行 - 滚动条有一些,然后文本保持器的矩形有一些,所以在边框上发生了很多事情。

对于程序员来说,从逻辑上看可能没有什么问题,逻辑上每个元素都有自己的边框。 但对于其他人来说,它看起来超载了。

这是一个视觉设计问题,而不是编程问题。 这更像是“为什么 iPod 很好,而 Zune 很丑”之类的事情 - 你无法得到直接可衡量的答案,但大多数人仍然会同意,这是一个事实,如果你关心他们,你需要做点什么意见 - 即卖给他们。

Just one example: if you look at the example you provided, you'll see lots of extra lines - a scrollbar has a few, then the rectangle of the text holder has a few, so on the border you have rather a lot happening.

For a programmer there may be nothing wrong for we see logically, and logically every element just has its own border. But for the rest of people it looks overloaded.

This is a visual design question, not a programming one. This is more like "why iPod is nice and the Zune ugly" kind of thing - you can't get a straight measurable answer, still most people would agree, and that's a fact you need to do something with, if you care about their opinions - i.e., to sell to them.

随心而道 2024-07-16 18:30:29

尝试客观地对待这样的问题是相当困难的,我认为这本质上是非常主观的。

有几点似乎让我感到不安:

  • 滚动条无处不在,不仅仅是在需要的地方
  • 相当“胖”的滚动条,占用了大量空间
  • 大量看起来粗体的字体,例如在菜单标题等中
  • 恒定宽度(“打字机”) style") 某些地方的文本

It's rather hard to try and be objective about such an issue, this is very subjective at heart I think.

A few points that seem to disturb me:

  • Scrollbars everywhere, not just where needed
  • Rather "fat" scrollbars, that take up a lot of room
  • Plenty of bold-looking fonts, e.g. in the menu titles and so on
  • Constant-width ("typewriter style") text in some places
奢望 2024-07-16 18:30:29

看来这个讨论应该
至少提及这些链接:

http://wiki.tcl.tk/8646
http://wiki.tcl.tk/9485

Seems this discussion ought to
at least mention these links:

http://wiki.tcl.tk/8646
http://wiki.tcl.tk/9485

烟雨凡馨 2024-07-16 18:30:29

Tk 漂亮与否,这取决于人,但我想说它至少不丑(Android 除外)。 看一下我使用纯 python 和 tkinter (Tk) 制作的程序的屏幕截图。 您只需要知道如何以更美观的方式使用它即可。在此处输入图像描述在此处输入图像描述

Tk is beautiful or not, it depends on the person but I would say that its atleast not ugly (except for android). Have a look at the screenshots of a program I made using pure python and tkinter (Tk). You just need to know how to use it in more beautiful manner.enter image description hereenter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文