如何选择合适的GUI工具包? [英] How to choose the right GUI toolkit ?

查看:67
本文介绍了如何选择合适的GUI工具包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我是Perl近期的迟来的皈依者。我在一个物理实验室工作并且

最近使用Python自动化了很多测量设备

。它为此目的非常有效。最近我想

开始为我的一些程序编写GUI,用于数据可视化和

以使程序更容易用于我的一些同事。


到目前为止,我已经尝试了两个Python GUI工具包:Tkinter和

PyGTK。我在每个方面遇到了一些问题:


* PyGTK - 在我看来并不是非常pythonic。必须使用get_和

set_方法而不是属性。必须编写丑陋的东西,比如

textview.insert(textview.get_end_iter(),...)将文本附加到文本

缓冲区。没有有用的文档字符串,这使得在IPython中尝试使用新的

小部件非常痛苦。该工具包感觉非常重量级。

我不想写一个XML文件和一个动作组。只需要制作一个带有10件物品的小菜单。


我是一个狂热的Gnome粉丝,并且热爱专业和完整

的GTK,但PyGTK看起来令人沮丧地像C-like相比我曾经喜欢的

Python中我们喜欢的精彩设计的高级抽象! br />

* TkInter - 似乎易于学习,更适合快速轻量级

GUI。我在不到一天的时间里写了一个完整的工作仪器GUI。在创建和修改小部件方面不是很好的Pythonic。没有工厂可以快速创建菜单项。

我对Tkinter最大的问题是它非常不可靠

Cygwin:程序间歇性地冻结和减速以及tkMessageDialog
股票对话框显示没有可见的文字。


那么,我应该看一下另一个工具包吗?有一些可以在Cygwin和原生Windows上轻松运行的东西是优先的,所以

我可以快速将程序移动到新的测量计算机上。我喜欢GTK一个

很多,而且Tk也在我身上发展..对于GTK和Tk,有没有更高级别的包装器

工具包?


感谢您的任何建议!


Dan Lenski

马里兰大学

解决方案

Dan Lenski写道:


那么,我应该看一下另一个工具包吗?



我强烈推荐wxPython。它非常成熟,功能齐全,便携式,并且相当容易学习。我不能把它与

其他工具包(除了Tkinter之外没有使用过任何工具包)进行比较,但是它是

绝对是最受欢迎的工具之一那里有很好的支持。

http://www.wxpython .org /




John Salerno写道:


Dan Lenski写道:


那么,我应该看一下另一个工具包吗?



我强烈推荐wxPython。它非常成熟,功能齐全,便携式,并且相当容易学习。我不能把它与

其他工具包(除了Tkinter之外没有使用过任何工具包)进行比较,但是它是

绝对是最受欢迎的工具之一那里有很好的支持。

http://www.wxpython .org /



我强烈建议您尝试使用PythonCard(位于

wxPython之上)。你可以非常快速地提高工作效率。请查看:

http://pythoncard.sourceforge .net / walkthrough1.html


John Salerno< jo ****** @ NOSPAMgmail.comwrote:
< blockquote class =post_quotes>
Dan Lenski写道:


那么,我应该看一下另一个工具包吗?



我强烈推荐wxPython。



我会第二个!


还有一本书


行动中的WxPython
http://www.amazon.com/Wxpython-Actio.../dp/1932394621

这当然是我学习新东西的首选方式!


它非常成熟,功能齐全,便于携带,而且很容易学习b $ b。



....与GTK / TK不同,每个平台都具有原生外观和感觉


它有一个巨大的设置小部件和一个优秀的演示程序在

,你可以尝试全部并窃取他们的代码。


有一些部分在其中C ++遗产很突出,但多年来工具包设计师一直把它们放在

地毯下。 MethodNaming也有点奇怪!


一个小小的烦恼是,有许多功能只有

在平台的一个子集上工作。这些都有很好的记录。


恕我直言最好的工具包,但它是个人选择,你的

可能会有所不同!


我们还写了PyQT,因为我们也想编写商业

应用程序。碰巧我们有一个商业QT许可证,但是我们决定我们不想再支付额外的费用来续订它。


-

Nick Craig-Wood< ni ** @ craig-wood.com-- http://www.craig-wood.com/nick


Hi all,
I''m a recent, belated convert from Perl. I work in a physics lab and
have been using Python to automate a lot of measurement equipment
lately. It works fabulously for this purpose. Recently I''ve wanted to
start writing GUIs for some of my programs, for data visualization and
to make the programs easier to use for some of my co-workers.

So far I''ve experimented with two Python GUI toolkits: Tkinter and
PyGTK. I''ve had some issues with each:

* PyGTK - not very "pythonic", in my opinion. Have to use get_ and
set_ methods rather than properties. Have to write ugly things like
textview.insert(textview.get_end_iter(), ...) to append text to a text
buffer. No useful doc strings, which makes experimenting with new
widgets in IPython a huge pain. The toolkit feels very "heavyweight".
I don''t want to write an XML file and an "action group" just to make a
piddly little menubar with 10 items.

I''m an avid Gnome fan, and love the professionalness and completeness
of GTK, but PyGTK seems frustratingly C-like compared to the
wonderfully designed high-level abstractions I''ve come to love in
Python!

* TkInter - Seems easy to learn, and better for quick "lightweight"
GUIs. I wrote a complete working instrument GUI in less than a day of
figuring things out. Not very Pythonic in terms of creating and
modifying widgets. No factory functions to quickly create menu items.
My biggest problem with Tkinter is that it is very unreliable under
Cygwin: programs freeze and slow intermittently and the tkMessageDialog
stock dialog boxes show no visible text.

So, is there another toolkit I should be looking at? Having something
that can run easily on Cygwin and native Windows is a priority so that
I can quickly move programs to new measurement computers. I like GTK a
lot and Tk is growing on me too.. are there any higher-level "wrapper"
toolkits for GTK and Tk?

Thanks for any advice!

Dan Lenski
University of Maryland

解决方案

Dan Lenski wrote:

So, is there another toolkit I should be looking at?

I highly recommend wxPython. It''s very mature, full-featured, and
portable, and fairly easy to learn as well. I can''t really compare it to
other toolkits (not having used any of them, except Tkinter), but it''s
definitely one of the most popular and well-supported ones out there.

http://www.wxpython.org/



John Salerno wrote:

Dan Lenski wrote:

So, is there another toolkit I should be looking at?


I highly recommend wxPython. It''s very mature, full-featured, and
portable, and fairly easy to learn as well. I can''t really compare it to
other toolkits (not having used any of them, except Tkinter), but it''s
definitely one of the most popular and well-supported ones out there.

http://www.wxpython.org/

I highly recommend that you try PythonCard (which sits on top of
wxPython). You can get productive very very quickly. Take a look at:

http://pythoncard.sourceforge.net/walkthrough1.html


John Salerno <jo******@NOSPAMgmail.comwrote:

Dan Lenski wrote:

So, is there another toolkit I should be looking at?


I highly recommend wxPython.

I''d second that!

There is a book also

"WxPython in Action"

http://www.amazon.com/Wxpython-Actio.../dp/1932394621

Which is certainly my preferred way of learning new stuff!

It''s very mature, full-featured, and portable, and fairly easy to
learn as well.

....with native look and feel on each platform unlike GTK / TK

It has got a huge set of widgets and an excellent demo program in
which you can try them all out and steal their code.

There are some bits of it in which the C++ heritage sticks out, but
over the years the toolkit designers have been tucking those under the
carpet. The MethodNaming is a bit odd too!

A minor annoyance is that there are a number of features which only
work on a subset of the platforms. These are well documented though.

IMHO the best of the toolkits, but it is a personal choice and yours
may differ!

There is also PyQT which we wrote off as we wanted to write commercial
applications too. As it happens we have a commercial QT licence, but
we decided we didn''t want to have to incurr the additional expense of
renewing it.

--
Nick Craig-Wood <ni**@craig-wood.com-- http://www.craig-wood.com/nick


这篇关于如何选择合适的GUI工具包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆