其他Python GUI工具包是否需要这个? [英] Do other Python GUI toolkits require this?

查看:55
本文介绍了其他Python GUI工具包是否需要这个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从PyObjC的介绍,Mac OS X上的Python-Objective-C桥:


"如Objective-C中所描述的PyObjC用户创建

Objective-C对象是一个两阶段的过程。要初始化对象,首先要调用一个类方法来分配内存(通常是alloc),然后再调用初始化程序(通常以init开头)。有些类具有

类方法,这些方法在幕后执行,特别是创建缓存,不可变或单例实例的类




一个例子:


myObject = NSObject.alloc()。init()


我知道Tkinter不要求任何手动内存分配这个

排序。当

创建对象时,wxPython,PyQt,PyGtk是否需要这样的东西?


-

Kevin Walzer

凯文代码
http://www.codebykevin.com

解决方案

Kevin Walzer写道:


从PyObjC的介绍中,Python- Mac上的Objective-C桥接

OS X:


"如Objective-C中所描述的PyObjC用户创建

Objective-C对象是一个两阶段的过程。要初始化对象,首先要调用一个类方法来分配内存(通常是alloc),然后再调用初始化程序(通常以init开头)。有些类具有

类方法,这些方法在幕后执行,特别是创建缓存,不可变或单例实例的类




一个例子:


myObject = NSObject.alloc()。init()


我知道Tkinter不要求任何手动内存分配这个

排序。当

创建对象时,wxPython,PyQt,PyGtk是否需要这样的东西?



这对Objective C来说或多或少都是独一无二的。它看起来很像使用

PyObjC,你必须与Objective C运行时交互以管理

内存。谢天谢地,这不是必需的,任何其他的图形用户界面

我见过。


我认为主要区别在于PyObjC不是GUI工具包本身,

,但它只是一种通过python层实现Objective C运行时(以及Cocoa)

的方法。


James


James Stroud写道:


这似乎或多或少是Objective C独有的。看起来,使用

PyObjC,你必须与Objective C运行时交互以管理

内存。谢天谢地,这不是必需的,任何其他的图形用户界面

我见过。


我认为主要区别在于PyObjC不是GUI工具包本身,

,但它只是一种通过python层实现Objective C运行时(以及Cocoa)

的方法。


James



这就是我的想法。内存管理?在Python? *颤抖*


我是一名Mac专用开发人员,我一直告诉自己我应该喝掉PyObjC的Mac-only Kool-aid。但是Tk被烧进了我的大脑,而且对于我来说,其他任何东西看起来都很奇怪。 Tk是如此灵活,以至于它很容易调整它看起来像Mac一样,并且这样做更简单。

比学习新的。


-

Kevin Walzer

凯文代码
http://www.codebykevin.com




2007年4月18日下午5:11,Kevin Walzer写道:


James Stroud写道:


>这对于Objective C来说或多或少是独一无二的。看起来,使用
PyObjC,你必须与Objective C运行时交互以管理内存。谢天谢地,这不是必需的,我已经看过任何其他的GUI。

我认为主要区别在于PyObjC本身并不是一个GUI工具包

但只是通过python层实现Objective C运行时(以及因此可可)的一种方法。

James


这就是我的想法。内存管理?在Python? *颤抖*


我是一名Mac专用开发人员,我一直告诉自己我应该喝掉PyObjC的Mac-only Kool-aid。但是Tk被烧进了我的大脑,而且对于我来说,其他任何东西看起来都很奇怪。 Tk是如此灵活,以至于它很容易调整它看起来像Mac一样,并且这样做更简单。

比学习新的。



PyObjC很漂亮(因为Ronald没有在

中做出任何提交,而我几乎可以肯定它'将出现在下一个官方

的devtools发行版中。大概是你放弃了PyQt的时间,然后切换到了Tkinter,切换到了PyObjC。

学习曲线是相当陡峭的IMO,但值得。有一点我认为

我应该提一下,如果你转移到PyObjC - 首先在Objective C中做一些

项目。否则你的大脑就会崩溃。


hth,

Michael


From the introduction to PyObjC, the Python-Objective-C bridge on Mac OS X:

"As described in Objective-C for PyObjC users the creation of
Objective-C objects is a two-stage process. To initialize objects, first
call a class method to allocate the memory (typically alloc), and then
call an initializer (typically starts with init). Some classes have
class methods which perform this behind the scenes, especially classes
that create cached, immutable, or singleton instances."

An example:

myObject = NSObject.alloc().init()

I know Tkinter doesn''t require any manual memory allocation of this
sort. Does wxPython, PyQt, PyGtk require anything like this when
creating objects?

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com

解决方案

Kevin Walzer wrote:

From the introduction to PyObjC, the Python-Objective-C bridge on Mac
OS X:

"As described in Objective-C for PyObjC users the creation of
Objective-C objects is a two-stage process. To initialize objects, first
call a class method to allocate the memory (typically alloc), and then
call an initializer (typically starts with init). Some classes have
class methods which perform this behind the scenes, especially classes
that create cached, immutable, or singleton instances."

An example:

myObject = NSObject.alloc().init()

I know Tkinter doesn''t require any manual memory allocation of this
sort. Does wxPython, PyQt, PyGtk require anything like this when
creating objects?

This appears more or less unique to Objective C. It looks that with
PyObjC, you have to interact with the Objective C runtime to manage
memory. This is not required, thankfully, with any other GUI tookits
I''ve seen.

I think the main difference is that PyObjC is not a GUI toolkit per se,
but is simply a means to make the Objective C runtime (and hence Cocoa)
available via a python layer.

James


James Stroud wrote:

This appears more or less unique to Objective C. It looks that with
PyObjC, you have to interact with the Objective C runtime to manage
memory. This is not required, thankfully, with any other GUI tookits
I''ve seen.

I think the main difference is that PyObjC is not a GUI toolkit per se,
but is simply a means to make the Objective C runtime (and hence Cocoa)
available via a python layer.

James

That''s kind of what I thought. Memory management? In Python? *shudder*

I''m a Mac-only developer, and I keep telling myself I should drink the
Mac-only Kool-aid of PyObjC. But Tk is burned into my brain, and
anything else looks and feels weird to me. Tk is so flexible that it''s
fairly easy to tweak it to look Mac-like, and it''s simpler to do that
than learn a new tookit.

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com



On Apr 18, 2007, at 5:11 PM, Kevin Walzer wrote:

James Stroud wrote:

>This appears more or less unique to Objective C. It looks that with
PyObjC, you have to interact with the Objective C runtime to manage
memory. This is not required, thankfully, with any other GUI tookits
I''ve seen.

I think the main difference is that PyObjC is not a GUI toolkit
per se,
but is simply a means to make the Objective C runtime (and hence
Cocoa)
available via a python layer.

James


That''s kind of what I thought. Memory management? In Python? *shudder*

I''m a Mac-only developer, and I keep telling myself I should drink the
Mac-only Kool-aid of PyObjC. But Tk is burned into my brain, and
anything else looks and feels weird to me. Tk is so flexible that it''s
fairly easy to tweak it to look Mac-like, and it''s simpler to do that
than learn a new tookit.

PyObjC is pretty slick (and since Ronald hasn''t made any commits in a
while I''m nearly certain it''ll show up in the next official
distribution of the devtools). About the time you gave up on PyQt on
the Mac and switched over to Tkinter, I switched to PyObjC. The
learning curve is rather steep IMO, but worth it. One thing I think
I should mention though is that if you move to PyObjC -- do some
projects in Objective C first. Otherwise your brain will implode.

hth,
Michael


这篇关于其他Python GUI工具包是否需要这个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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