Carbon Event Manager (Carbon.CarbonEvt module) - working?

M

msmucr

Hello,

i would like to ask you for some information regarding Carbon Event
Manager ( Carbon.CarbonEvt ) library in Python.
I need to recieve and work with few Carbon events in my program. I've
followed some examples on PyObjC site, but wasn't successful. I know,
that both Carbon library and this Python module is deprecated, but
frankly i didn't find any usable alternative except of writing of
something from scratch..
I ended on basic import of required objects from Carbon.CarbonEvt
module -
like "from Carbon.CarbonEvt import RegisterEventHotKey"
I tried it in Python 2.7.1 (standard distribution in OS X 10.7 Lion)
and Python 2.6.1 (standard Apple distribution in OS X 10.6).
Do I have something wrong or is it simply broken and unmaintained now?

Thank You,

Michal
 
J

John Gordon

In said:
Do I have something wrong or is it simply broken and unmaintained now?

We have no idea if you did anything wrong, because you didn't tell us
exactly what you did and exactly what error message you received.
 
K

Kevin Walzer

Do I have something wrong or is it simply broken and unmaintained now?

Support for Carbon Events was removed in Python 3.x and it does not work
in 64-bit, to my knowledge--most of the Carbon API's are not supported
by Apple anymore.
 
M

msmucr

We have no idea if you did anything wrong, because you didn't tell us
exactly what you did and exactly what error message you received.

Hello,

i'm sorry for my very vague specification. I had problems with
importing of anything from Carbon.CarbonEvt module and i wasn't sure
what is wrong and was little bit stucked.
I tried several desperate things before that as i've never worked with
this module and it is my first thing with Carbon library.. Just before
i read Kevin's reply i've figured, problem was, that OS X shipped
Python wrapper /usr/bin/python runs by default 64bit version on recent
Macs. So bindings for 32bit Carbon lib didn't work.
Here is my output (i've choose RegisterEventHotKey as example):

macmini-E514:~ macek$ /usr/bin/python -c "import sys; print
sys.maxint; from Carbon.CarbonEvt import RegisterEventHotKey;
print(RegisterEventHotKey.__doc__)"
9223372036854775807
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: cannot import name RegisterEventHotKey

macmini-E514:~ macek$ env VERSIONER_PYTHON_PREFER_32_BIT=yes /usr/bin/
python -c "import sys; print sys.maxint; from Carbon.CarbonEvt import
RegisterEventHotKey; print(RegisterEventHotKey.__doc__)"
2147483647
(UInt32 inHotKeyCode, UInt32 inHotKeyModifiers, EventHotKeyID
inHotKeyID, EventTargetRef inTarget, OptionBits inOptions) ->
(EventHotKeyRef outRef)

So, now i could start playing with it.. :)

I'm trying to do something like this in Python
http://www.macosxguru.net/article.php?story=20060204132802111

Best regards and thank you for replies

Michal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top