本文介绍了Python组件模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在下面使用的组件模型的定义是一个允许

属性,方法和事件的类,它们可以通过结构化方式识别,通常通过某种形式的内省除了

类。这种结构化的方式允许可视化工具托管组件,并且
允许程序员在RAD

环境中直观地构建应用程序和库。


Java语言将JavaBeans作为其组件模型,允许以可视RAD方式构建Java

应用程序。微软的.Net有一个内置于.Net类库的

组件模型以及CLR支持的
,它允许.Net应用程序可视化构建

使用以任何.Net支持的语言创建的组件。


使用Python的东西是不同的。没有单一的组件模型

允许Python开发人员构建将被用于
并且被市场上各种RAD Python工具识别的组件。相反,

开发人员必须为每个RAD Python工具创建一个稍微不同的Python类集合。这种情况就是这样的情况,尽管Python有很多功能,如果不是更多的话,可以像Java或.Net那样使用
语言,例如C#,VB或C ++ / CLI用于创建组件,以及

允许可视化工具内省属性,方法和事件

的Python类。


我相信Python应该有一个适用于所有RAD

开发环境的通用组件模型,因为这样可以让Python程序员创建一组代表组件的类适用于任何

环境。我想立即指出组件没有

只是意味着可视化的GUI组件,但可能更重要的是,

非可视组件。使用RAD开发环境来创建应用程序后,我发现这样的环境几乎总是比手动编写复杂交互更好,我相信

视觉开发环境几乎是当今世界的必需品。

的大型,多层和企业应用程序。


有没有曾经,或者现在有没有人,在Python

开发者社区中看到了同样的需求,并且正在努力实现Python中通用组件模型的目标
,祝福并鼓励那些自己维护Python语言和标准模块的人?

The definition of a component model I use below is a class which allows
properties, methods, and events in a structured way which can be
recognized, usually through some form of introspection outside of that
class. This structured way allows visual tools to host components, and
allows programmers to build applications and libraries visually in a RAD
environment.

The Java language has JavaBeans as its component model which allows Java
applications to be built in a visual RAD way. Microsoft''s .Net has a
component model built-in to its .Net class libraries as well as
supported by CLR which allows .Net applications to be built visually
using components created in any .Net supported language.

With Python things are different. There is no single component model
which allows Python developers to build components which will be used
and recognized by the various RAD Python tools on the market. Instead a
developer must create a slightly different set of Python classes for
each RAD Python tool. This is the situation despite Python''s having
easily as much functionality, if not much more, as Java or .Net
languages such as C#, VB, or C++/CLI for creating components, and for
allowing visual tools to introspect the properties, methods, and events
of Python classes.

I believe that Python should have a common components model for all RAD
development environments, as that would allow the Python programmer to
create a set of classes representing components which would work in any
environment. I want to immediately point out that components do not
simply mean visual GUI components but what may be even more important,
non-visual components. Having used RAD development environments to
create applications, I have found such environments almost always much
better than coding complex interactions manually, and I believe that
visual development environments are almost a necessity in today''s world
of large-scale, multi-tier, and enterprise applications.

Has there ever been, or is there presently anybody, in the Python
developer community who sees the same need and is working toward that
goal of a common component model in Python, blessed and encouraged by
those who maintain the Python language and standard modules themselves ?

推荐答案



恕我直言,那些其他语言的RAD工具已经到位,以避免写太多

无聊的锅炉板代码。至少那就是那些工具通常会产生的代码:程序员应该单独留下的代码或者一轮的代码,或者是b $ b的旅行,RAD工具一个?代码?? ?? RAD工具,不再起作用了。如果你在使用Python进行编程时遇到这种情况,那么几乎总是很容易将其中的大部分分解出来。 Python本身就是一个RAD工具。


Ciao,

Marc''BlackJack''Rintsch

IMHO those RAD tools in other languages are in place to avoid writing much
boring boiler plate code. At least that is what those tools usually
produce: tons of code that the programmer should leave alone or the round
trip, RAD tool a?? code a?? RAD tool, does not work anymore. If you come
across such a situation while programming in Python it is almost always
easy to factor out most of it. Python itself is a RAD tool.

Ciao,
Marc ''BlackJack'' Rintsch





如果您正在谈论创建GUI并且能够使用不同的GUI库运行运行
比如Tkinter,wxPython,wxgtk等等。

你可以看看Dabo(。它的设计使你可以设计你的GUI并让它运行你想要的GUI库(目前只支持wxPython。而且我认为

Tkinter有点工作。)


-

现在我是基督徒我没有心情整个

的东西看起来很不可能:但是当我还是一个无神论者的时候,我心情很好,基督教看起来非常可能。

- C。 S. Lewis


-Echo


If you are talking about about creating a GUI and having be able to
run using different GUI libraries like Tkinter, wxPython, wxgtk, ect.
You could look into Dabo(http://dabodev.com/). It is designed so that
you can design your GUI and have it run with what ever GUI library you
want(only wxPython is supported at the moment. And I think that
Tkinter works somewhat.)

--
"Now that I am a Christian I do not have moods in which the whole
thing looks very improbable: but when I was an atheist I had moods in
which Christianity looked terribly probable."
-C. S. Lewis

-Echo


这篇关于Python组件模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 12:45