GUI 布局 - 如何?
我最近一直在与一些 RAD gui 构建者合作。我绝对鄙视CSS(骆驼是委员会等设计的马)打包管理器使用什么算法(java / tk)。我使用过的大多数 GUI 工具包都有绝对定位的替代方案,对于含糊之处表示抱歉,但是您如何开始考虑用 X 语言实现打包管理器。
感谢您的回复,澄清一下 - 我想创建一个通用的定义“表单”的文本文件,然后可以使用此表单文件生成本机(ish)GUI 表单(例如 tk)以及 HTML 表单。
我正在寻找的是有关如何实现基于网格的打包管理器的一些指示,以便我可以根据某种形式的既定逻辑制定通用文本文件。
如果这对您来说没有意义,那么您就理解我了:)。一些笔记
1. XML 与斑马和骆驼生活在同一个马厩,但与马不同。
2. 考虑轻量级标记语言(Markdown/ReStructuredText),但用于简单的形式。
3. 这可能已经实施了,你知道在哪里吗?
4. 是的,我用谷歌搜索过(很多很多次),答案不在 G1 和 o2 之间
Thks
I've been working with a few RAD gui builders lately. I absolutely despise CSS ( camel is a horse designed by committee etc.) What algorithms are used by packing managers(java/tk). Most GUI toolkits I've used have some alternative to absolute positioning, sorry for the ambiguity but how do you start thinking about implementing a packing manger in language X.
Thanks for the replies, to clarify - I want to create a generic text file that defines a 'form' this form file can then be used to generated a native(ish) GUI form (eg tk) and also an HTML form.
What I'm looking for is some pointers on how a grid based packing manager is implemented so I can formulate my generic text file based on some form of established logic.
If this doesn't make sense to you then you understand me:). Some notes
1. XML lives in the same stable as the zebra and the camel but not the horse.
2. Think lightweight markup languages (Markdown/ReStructuredText) but for simple forms.
3. This has probably already been implemented, do you know where?
4. Yes, I have Googled it (many,many times),answer was not between G1 and o2
Thks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Tk 具有三种方法。一种是绝对定位,另外两种分别称为“grid”和“pack”。
网格顾名思义:您将小部件放置在网格中。有用于跨越行和列、扩展(或不扩展)以填充单元格、指定可以增长的行或列等的选项。您可以使用网格几何管理器完成大约 90% 的布局问题。
另一个管理器是“pack”,它的工作原理是请求将小部件放置在一侧或另一侧(顶部、底部、左侧、右侧)。它非常强大,并且通过使用嵌套容器(在传统知识中称为框架),您还可以完成几乎任何布局。当您将东西沿单一方向堆叠时(例如工具栏水平堆叠,主应用程序垂直堆叠(工具栏、主区域、状态栏)),Pack 特别方便。
grid 和 pack 都非常强大且易于使用,它们可以解决您遇到的任何布局问题。这让我想知道为什么 Java 和 wxPython 有如此多且如此复杂的几何管理器,而只需要三个就可以了。
Tk has three methods. One is absolute positioning, the other two are called "grid" and "pack".
grid is just what it sounds like: you lay out your widgets in a grid. There are options for spanning rows and columns, expanding (or not) to fill a cell, designating rows or columns which can grow, etc. You can accomplish probably 90% of all layout issues with the grid geometry manager.
The other manager is "pack" and it works by requesting that widgets be placed on one side or another (top, bottom, left, right). It is remarkably powerful, and with the use of nested containers (called frames in tk) you can accomplish pretty much any layout as well. Pack is particularly handy when you have things stacked in a single direction, such as horizontally for a toolbar, vertically for a main app (toolbar, main area, statusbar).
Both grid and pack are remarkably powerful and simple to use, and between them can solve any layout problem you have. It makes me wonder why Java and wxPython have so many and such complicated geometry managers when its possible to get by with no more than three.