PyObjC DiscRecordingUI Framework

12.1 · active · verified Tue Apr 14

PyObjC is a bidirectional bridge that allows Python programs to interact with Objective-C frameworks on macOS. This package, `pyobjc-framework-discrecordingui`, provides Python wrappers for the DiscRecordingUI framework, enabling developers to integrate disc burning and erasing user interfaces into their macOS applications. The library is actively maintained, currently at version 12.1, with releases often tied to new macOS SDK updates and Python version support cycles.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates the basic structure of a PyObjC application, using `NSApplication` and `PyObjCTools.AppHelper` to manage the event loop. It shows how to import and instantiate a class from the `DiscRecordingUI` framework (e.g., `DRBurnSetupPanel`). In a full application, you would present UI elements and implement delegate methods to interact with them.

import objc
from Foundation import NSObject, NSApplication
from AppKit import NSApplicationActivationPolicyRegular
from PyObjCTools import AppHelper
from DiscRecordingUI import DRBurnSetupPanel, DRBurnSetup, DRBurnCompletionAction


class AppDelegate(NSObject):
    def applicationDidFinishLaunching_(self, notification):
        print("Application started.")
        # Create a burn setup panel (example usage)
        panel = DRBurnSetupPanel.new()
        
        # In a real application, you'd present this panel and handle its delegate methods
        # For demonstration, we'll just show its existence.
        print(f"Created DRBurnSetupPanel: {panel}")
        
        # To prevent the app from immediately quitting in a simple script,
        # a real UI event loop is needed. For CLI demo, we can just let it exit.
        # If you were to present a panel, you'd typically do something like:
        # panel.beginSetupSheetForWindow_modalDelegate_didEndSelector_contextInfo_(
        #    None, self, 'burnSetupSheetDidEnd_returnCode_contextInfo:', None)
        
        # For a truly minimal UI app to stay open:
        # NSApp.run()

    def applicationWillTerminate_(self, notification):
        print("Application will terminate.")

if __name__ == '__main__':
    # Initialize the NSApplication
    app = NSApplication.sharedApplication()
    app.setActivationPolicy_(NSApplicationActivationPolicyRegular)

    # Create and set the delegate
    delegate = AppDelegate.alloc().init()
    app.setDelegate_(delegate)

    # Run the application event loop
    # For a real GUI app, this keeps it running.
    # For this minimal example, it might exit quickly if no windows are shown.
    AppHelper.runEventLoop()

view raw JSON →