Python UI question

Discussion in 'Mac Programming' started by lynkynpark86, Dec 21, 2011.

  1. macrumors 6502

    Is there a way to show a dialog box in Python without Tk, wx-python, etc? Is there something similar to AppleScript's "display dialog" I could use?
  2. macrumors 604

    Aug 9, 2009
    Run the 'osascript' command from Python.

    Example shell command line:
    osascript -e 'tell app "System Events" to display dialog "Explode the penguin now?"'
    I assume you know how to open the man page for osascript, how to run subprocesses in Python, etc.
  3. thread starter macrumors 6502

    Thanks, I just tried:
    osascript -e 'display dialog "Hello world"'
    It works now with system events, thanks!

Share This Page