37.8. Mac OS 工具箱模块

这些是一组模块,可提供与各种旧版 Mac OS 工具箱的接口。如果适用,模块将为工具箱语句的各种结构定义许多 Python 对象,并且操作将作为对象的方法实现。其他操作将作为模块中的Function实现。并非在 C 中所有可能的操作在 Python 中也将成为可能(回调通常是一个问题),并且参数在 Python 中有时会有所不同(尤其是 Importing 和输出缓冲区)。所有方法和函数都有一个__doc__字符串,描述其参数和返回值,对于其他描述,您可以参考Inside Macintosh或类似的作品。

这些模块都存在于名为Carbon的程序包中。尽管有这个名字,但它们并不是 Carbon 框架的全部:CF 实际上在 CoreFoundation 框架中,而 Qt 在 QuickTime 框架中。正常使用方式是

from Carbon import AE

Note

这些模块使用的大多数 OS X API 在最新版本的 OS X 中已被弃用或删除。当 Python 以 64 位模式执行时,许多 API 不可用。 Carbon 模块已在 Python 3 中删除。您应该避免在 Python 2 中使用它们。

37.8.1. Carbon.AE-苹果活动

37.8.2. Carbon.AH-Apple 帮助

37.8.3. Carbon.App —外观 Manager

37.8.4. Carbon.Appearance-外观 Management 器常数

37.8.5. Carbon.CF —核心基础

支持CFBaseCFArrayCFDataCFDictionaryCFStringCFURL对象,有些仅被部分支持。

37.8.6. Carbon.CG —核心图形

37.8.7. Carbon.CarbonEvt-碳事件 Manager

37.8.8. Carbon.CarbonEvents — Carbon Event Manager 常数

37.8.9. Carbon.Cm —组件 Management 器

37.8.10. Carbon.Components —组件 Management 器常量

37.8.11. Carbon.ControlAccessor —控制 Management 中心 Management 员

37.8.12. Carbon.Controls-控制 Management 中心常数

37.8.13. Carbon.CoreFounation — CoreFounation 常数

37.8.14. Carbon.CoreGraphics — CoreGraphics 常数

37.8.15. Carbon.Ctl-控制 Management 员

37.8.16. Carbon.Dialogs —对话框 Management 器常量

37.8.17. Carbon.Dlg-对话框 Management 器

37.8.18. Carbon.Drag —拖放 Management 器

37.8.19. Carbon.Dragconst —拖放 Management 器常数

37.8.20. Carbon.Events —事件 Management 器常量

37.8.21. Carbon.Evt-活动 Manager

37.8.22. Carbon.File —文件 Management 器

37.8.23. Carbon.Files —文件 Management 器常量

37.8.24. Carbon.Fm —字体 Management 器

37.8.25. Carbon.Folder-文件夹 Management 器

37.8.26. Carbon.Folders —文件夹 Management 器常数

37.8.27. Carbon.Fonts —字体 Management 器常数

37.8.28. Carbon.Help-帮助 Manager

37.8.29. Carbon.IBCarbon — Carbon InterfaceBuilder

37.8.30. Carbon.IBCarbonRuntime — Carbon InterfaceBuilder 常量

37.8.31. Carbon.Icn — Carbon 图标 Manager

37.8.32. Carbon.Icons-Carbon 图标 Management 器常数

37.8.33. Carbon.Launch —碳运行服务

37.8.34. Carbon.LaunchServices —碳运行服务常数

37.8.35. Carbon.List —列表 Management 器

37.8.36. Carbon.Lists —列表 Management 器常量

37.8.37. Carbon.MacHelp —帮助 Management 器常量

37.8.38. Carbon.MediaDescr — Quicktime MediaDescriptors 的解析器和生成器

37.8.39. Carbon.Menu —菜单 Management 器

37.8.40. Carbon.Menus —菜单 Management 器常数

37.8.41. Carbon.Mlte —多语言文本编辑器

37.8.42. Carbon.OSA — Carbon OSA 接口

37.8.43. Carbon.OSAconst — Carbon OSA 接口常数

37.8.44. Carbon.QDOffscreen — QuickDraw 离屏常量

37.8.45. Carbon.Qd-QuickDraw

37.8.46. Carbon.Qdoffs-屏幕外的 QuickDraw

37.8.47. Carbon.Qt — QuickTime

37.8.48. Carbon.QuickDraw — QuickDraw 常数

37.8.49. Carbon.QuickTime-QuickTime 常数

37.8.50. Carbon.Res —资源 Management 器和句柄

37.8.51. Carbon.Resources —资源 Management 器和处理常量

37.8.52. Carbon.Scrap —废料 Management 器

此模块仅在 Mac OS 9 及更早版本的经典 PPC MacPython 下完全可用。 Carbon MacPython 提供的Function非常有限。

废品 Management 器支持 Macintosh 上最简单的剪切和粘贴操作形式。它可以用于应用程序间和应用程序间剪贴板操作。

Scrap模块提供对废品 Management 器Function的低级访问。它包含以下Function:

  • Carbon.Scrap. InfoScrap ( )
    • 返回有关废料的当前信息。该信息被编码为包含字段(size, handle, count, state, path)的 Tuples。
FieldMeaning
size废料的大小(以字节为单位)。
handle代表废料的资源对象。
count废料内容的序列号。
state整数;如果在内存中,则为正;如果在磁盘中,则为0;如果未初始化,则为负。
path废料存储在磁盘上时的文件名。

See also

  • Scrap Manager

  • Apple 的 Scrap Manager 文档提供了有关在应用程序中使用 Scrap Manager 的许多有用信息。

37.8.53. Carbon.Snd —声音 Management 器

37.8.54. Carbon.Sound —声音 Management 器常数

37.8.55. Carbon.TE — TextEdit

37.8.56. Carbon.TextEdit — TextEdit 常量

37.8.57. Carbon.Win —窗口 Management 器

37.8.58. Carbon.Windows —窗口 Management 器常数